IonicWind Software

IWBasic => General Questions => Topic started by: Andy on January 13, 2018, 05:09:47 AM

Title: Vertically align static text
Post by: Andy on January 13, 2018, 05:09:47 AM
Does any one know how to vertically align text in a static?

The text appears near the top border of the static and I would like a way to move it down slightly, best case would be centered.

I think you can do it with buttons but can't find anything on msdn about the same for statics.

Thanks,
Andy.
Title: Re: Vertically align static text
Post by: Egil on January 13, 2018, 08:55:18 AM
Andy,

Why not use a RichEdit Control?


AutoDefine "Off"

def win:window 
def run,wstyle:int 
wstyle = @MINBOX|@MAXBOX|@size|@TOOLWINDOW


' Create a window .. 
OpenWindow win,0,0,480,300,wstyle,0,"  IWB Test Window",&messages 


CONTROL win,@RICHEDIT,"TEST",150,100,12,100,@CTEDITRO|@CTEDITMULTI,100
'setcontroltext win,100,"Test"


run = 1 
WAITUNTIL run = 0 
CLOSEWINDOW win 
END 


'
' Main loop
'-------------------------------------------------------------------------------------
SUB messages(),int

SELECT @class

CASE @idcreate 
centerwindow win

CASE @idclosewindow 
run = 0 

ENDSELECT 

RETURN  0
EndSub
'-------------------------------------------------------------------------------------
'

Title: Re: Vertically align static text
Post by: LarryMc on January 13, 2018, 10:03:11 AM
Andy
Add a style of 0x200.
That will center the text exactly vertically in the box (give or take 1 pixel)

I need to add that flag to iwbstd.incc.
Title: Re: Vertically align static text
Post by: Andy on January 13, 2018, 10:27:20 PM
Larry,

That's perfect, thank you!

The text looks so much better now it's aligned.

Andy.
:)
Title: Re: Vertically align static text
Post by: billhsln on January 13, 2018, 11:03:29 PM
Also came in handy for me.  Makes the program look much cleaner.

Bill