I want to change the tabsize in my richedit control, and hutch pointed me to EM_SETTABSTOPS. I dont really understand how all this works.. could someone show me an example of what to send in the message? just assume that i want to change the tabsize to 4 (instead of the default 6), and once i see that, i will be able to code in support for reading the tabsize from my ini file

Thanks,
Karl Haines
Posted on 2001-07-19 20:01:08 by karl
I've looked up EM_SETTABSTOPS in the Win32 API reference and I assume you would need to do something like this:


invoke SendMessage, hEdit, 1, 4

Perhaps dialog box units is spaces?
Posted on 2001-07-19 21:03:27 by comrade
Thanks!!
Posted on 2001-07-20 03:22:23 by karl
No,

invoke SendMessage,hwndRichEdit,EM_SETTABSTOPS,1,4

does not work, the program crashes
Posted on 2001-07-20 03:25:39 by karl
Karl,

The second parameter isn't right, that's why the program is crashing. It has to be the address of the value, not the value itself.

You have two ways of setting tabstops:-

1) Make all the tabstops the same
2) have different sizes for each tabstop.

The first one is the easiest, to do this you use something like:-



.data

TabStopCount dd 1 ; one tabstop
TabStopWidth dd 8 ; 8 Dialog units

.code

invoke SendMessage,hEdit,EM_SETTABSTOPS,TabStopCount,addr TabStopWidth


This will set each tabstop to 8 dialog units wide (the default is 32)


To set a number of different tabstop, you need an array of them like this:-





.data

TabStopCount dd 4 ; four tabstops
TabStopWidth dd 8,23,4,3 ;

.code

invoke SendMessage,hEdit,EM_SETTABSTOPS,TabStopCount,addr TabStopWidth


This will set them at 8, 23, 4 and 3 respectively (you'll have to experiment to see if it is a relative offset or an absolute value)


good luck!

umbongo
Posted on 2001-07-20 03:37:33 by umbongo
Thanks!

.data
TabStopCount dd 1
TabStopWidth dd 16

gave me a 4 space tab!!

Appreciate the Help very much!
Posted on 2001-07-20 05:09:59 by karl
Actually, NO that gave me like 4.5 spaces, i really need to figure out how to do it at exactally 4 spaces, and i'm not understaning this stuff.. please help :confused:
Posted on 2001-07-27 04:45:36 by karl
Stolen directly from the Manual :-

The values specified by the lpdwTabs parameter are in dialog template units, which are the device-independent units used in dialog box templates. To convert measurements from dialog template units to screen units (pixels), use the MapDialogRect function.

umbongo
Posted on 2001-07-27 04:52:10 by umbongo