IonicWind Software

IWBasic => GUI Central => Topic started by: LarryMc on June 07, 2009, 06:12:40 PM

Title: Tab size in a Rich Edit
Post by: LarryMc on June 07, 2009, 06:12:40 PM
I created a richedit control and loaded some source code in it.
The tab spacing is way to big for my liking.
Couldn't find a command in the help file to set tab spacing

Tried the following right after creating the control in a window:

SETID "WM_USER",0x400
CONST EM_SETPARAFORMAT = (WM_USER + 71)
CONST PFM_TABSTOPS = &H10

TYPE PARAFORMAT,4
   DEF cbSize as UINT
   DEF dwMask as UINT
   DEF wNumbering as WORD
   DEF wReserved as WORD
   DEF dxStartIndent as INT
   DEF dxRightIndent as INT
   DEF dxOffset as INT
   DEF wAlignment as WORD
   DEF cTabCount as WORD
   DEF rgxTabs[32] as INT
ENDTYPE
PARAFORMAT pf
pf.cbSize=len(PARAFORMAT)
pf.dwMask=PFM_TABSTOPS
pf.cTabCount=5
pf.rgxTabs[0]=200
pf.rgxTabs[1]=400
pf.rgxTabs[2]=600
pf.rgxTabs[3]=800
pf.rgxTabs[4]=100

sendmessage win_code,EM_SETPARAFORMAT,0,&pf,IDE_CODE


Didn't appear to do anything.

Anyone see what I did wrong?

revision:found where it said tabs were in twips no I increased the numbers but still no change.

Larry

Title: Re: Tab size in a Rich Edit
Post by: Ionic Wind Support Team on June 07, 2009, 10:02:30 PM
Recheck the paraformat UDT, don't use API Viewer as it is wrong 75% of the time, use sapero's windows includes.

There are 1440 twips in an inch, so a setting of 200 for a tab stop would be about the width of a character.

Paul.
Title: Re: Tab size in a Rich Edit
Post by: sapero on June 08, 2009, 02:52:04 AM
In Edit controls and Rich Edit 3.0 you could use EM_SETTABSTOPS, it is much easier, but the control must be multiline
SendMessage(win, EM_SETTABSTOPS, count, &int_array, id)
If count is zero, default tab stops are set at every 32 dialog template units.
If count is 1, tab stops are set at every n dialog template units, where n is the distance pointed to by the lParam parameter.
If count is greater than 1, lParam is a pointer to an array of tab stops.
int tabsize = 16
SendMessage(win, EM_SETTABSTOPS, 1, &tabsize, id)

int tabs[3]
tabs = 16,20,24
SendMessage(win, EM_SETTABSTOPS, 3, &tabs, id)
Title: Re: Tab size in a Rich Edit
Post by: LarryMc on June 08, 2009, 03:00:20 AM
Quote from: Paul Turley on June 07, 2009, 10:02:30 PM
Recheck the paraformat UDT, don't use API Viewer as it is wrong 75% of the time, use sapero's windows includes.
In this particular case I used the one in your controlcmd source so I would know it was right.

Thanks

Larry
Title: Re: Tab size in a Rich Edit
Post by: LarryMc on June 08, 2009, 03:13:36 AM
Thanks Sapero!
I used your 1st example with a value of 10 and got the exact look I wanted.

Larry