June 30, 2024, 06:48:52 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Tab size in a Rich Edit

Started by LarryMc, June 07, 2009, 06:12:40 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

LarryMc

June 07, 2009, 06:12:40 PM Last Edit: June 07, 2009, 06:33:16 PM by Larry McCaughn
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

LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Ionic Wind Support Team

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.
Ionic Wind Support Team

sapero

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)

LarryMc

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
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

LarryMc

Thanks Sapero!
I used your 1st example with a value of 10 and got the exact look I wanted.

Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library