1. Tab Size setting in Edit fields (win32Lib)
- Posted by Dave Probert <zingo at purpletiger.com> May 16, 2005
- 495 views
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. Cheers. . .. : :: = == == = :: : .. . Server-Side DB driven web sites, Software Development and part-time games developer contact dave_p at purpletiger dot com or probert.dave at gmail dot com . .. : :: = == == = :: : .. .
2. Re: Tab Size setting in Edit fields (win32Lib)
- Posted by Derek Parnell <ddparnell at bigpond.com> May 16, 2005
- 542 views
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
3. Re: Tab Size setting in Edit fields (win32Lib)
- Posted by Dave Probert <zingo at purpletiger.com> May 16, 2005
- 497 views
- Last edited May 17, 2005
Hi Derek, That's one of the things I tried, but every time I use a wParam of 1 then I get a machine exception (in w32Func) when starting my program. txtSpecificContent is an MleText object. VOID = sendMessage(txtSpecificContent,EM_SETTABSTOPS,1,3) (I've used other values instead of 3 as well) or with VOID = sendMessage(txtSpecificContent,EM_SETTABSTOPS,3,{12,12,12}) (for example) I get no tabs at all. Is there some specific way of pasing these numbers - basically I'm using FixedSys font and would like the tabs at 3 char spacing. The magic of the internal workings of Edit fields eludes me all the time ;) Cheers, Dave Derek Parnell wrote: > > 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 -- Snip -- > 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. -- Snip -- . .. : :: = == == = :: : .. . Server-Side DB driven web sites, Software Development (and part-time games developer) contact dave_p at purpletiger dot com or probert.dave at gmail dot com . .. : :: = == == = :: : .. .
4. Re: Tab Size setting in Edit fields (win32Lib)
- Posted by Derek Parnell <ddparnell at bigpond.com> May 17, 2005
- 489 views
Dave Probert wrote: > > Hi Derek, > > That's one of the things I tried, but every time I use a wParam of 1 then I > get a machine > exception (in w32Func) when starting my program. > > txtSpecificContent is an MleText object. > > VOID = sendMessage(txtSpecificContent,EM_SETTABSTOPS,1,3) > (I've used other values instead of 3 as well) Try this instead... VOID = sendMessage(txtSpecificContent,EM_SETTABSTOPS,1,{3} * 4}) The 4th parameter of EM_SETTABSTOPS must be a pointer to an array of integers. If the 3rd parameter is '1', then only one integer needs to be stored and it represents the number of 'dialog-units' for each tabstop. A 'dialog-unit' is one quarter of the font's width. If you use a count of more than 1, then the array represents the absolute position of each tabstop. So you could use this ... VOID = sendMessage(txtSpecificContent,EM_SETTABSTOPS,4,{3,6,9,12} * 4) to set four tabstops at *character* positions : 3, 6, 9, and 12. -- Derek Parnell Melbourne, Australia irc://irc.sorcery.net:9000/euphoria
5. Re: Tab Size setting in Edit fields (win32Lib)
- Posted by Dave Probert <zingo at purpletiger.com> May 17, 2005
- 493 views
Thanks Derek, works perfectly. I guess I'm just no good at reading MicroSoft documentation :). That makes my editor fields look soooo much better. Cheers, Dave . .. : :: = == == = :: : .. . Server-Side DB driven web sites, Software Development (and part-time games developer) contact dave_p at purpletiger dot com or probert.dave at gmail dot com . .. : :: = == == = :: : .. .