Re: Tab Size setting in Edit fields (win32Lib)

new topic     » goto parent     » topic index » view thread      » older message » newer message

Dave Probert wrote:
> 
> Ok, Ok, I guess this is not a hard question to answer, but I can't figure it
> out -
> so I thought I'd ask :)
> 
> How does one set the Tab Character size for an EditText,MleText,RichEdit or
> whatever
> field?  I'd like it to be 3 characters wide instead of the default 8
> characters!!
> 
> Any help here would be appreciated.

You could use the setTabs() routine for RichEdit fields.

Or you can issue the EM_SETTABSTOPS message to multiline edit fields or rich
edits - doesn't work for single line edit fields.

Quoting from the WIndows SDK ...

----------------------
EM_SETTABSTOPS Message

--------------------------------------------------------------------------------

The EM_SETTABSTOPS message sets the tab stops in a multiline edit control. When
text is copied to the control, any tab character in the text causes space to be
generated up to the next tab stop.

This message is processed only by multiline edit controls. You can send this
message to either an edit control or a rich edit control.


Syntax


To send this message, call the SendMessage function as follows. 
lResult = SendMessage(      // returns LRESULT in lResult     (HWND)
hWndControl,      // handle to destination control     (UINT) EM_SETTABSTOPS,    
 // message ID     (WPARAM) wParam,      // = (WPARAM) () wParam;    (LPARAM)
lParam      // = (LPARAM) () lParam; );
Parameters

wParam
Specifies the number of tab stops contained in the array. If this parameter is
zero, the lParam parameter is ignored and default tab stops are set at every 32
dialog template units. If this parameter is 1, tab stops are set at every n
dialog template units, where n is the distance pointed to by the lParam
parameter. If this parameter is greater than 1, lParam is a pointer to an array
of tab stops.
lParam
Pointer to an array of unsigned integers specifying the tab stops, in dialog
template units. If the wParam parameter is 1, this parameter is a pointer to an
unsigned integer containing the distance between all tab stops, in dialog
template units.
Windows 95/98/Me: The buffer pointed to by lParam must reside in writable
memory, even though the message does not modify the array.

Return Value

If all the tabs are set, the return value is TRUE. 
If all the tabs are not set, the return value is FALSE.



Remarks

The EM_SETTABSTOPS message does not automatically redraw the edit control
window. If the application is changing the tab stops for text already in the edit
control, it should call the InvalidateRect function to redraw the edit control
window.

The values specified in the array 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.

Rich Edit: Supported in Microsoft® Rich Edit 3.0 and later. For information
about the compatibility of rich edit versions with the various system versions,
see About Rich Edit Controls.

----------------------
-- 
Derek Parnell
Melbourne, Australia
irc://irc.sorcery.net:9000/euphoria

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu