Page 2 of 2

Re: Center Align String - OS Version specific issue?

Posted: Tue Jan 01, 2013 6:27 pm
by Josh
Without an additional Gadget, you can change the (vertical) margins with "EM_SETRECT". This works only with multiline edit controls, but you can use a multiline gadget for one line too.

There is an example at RSbasic's winapi library:
http://www.rsbasic.de/aktualisierung/wi ... trieren.pb


P.S.: Don't mix windows styles between different controls

TextGadget = static control = static style = #SS_CENTER (not #ES_CENTER)
StringGadget = edit control = edit style = #ES_CENTER

Re: Center Align String - OS Version specific issue?

Posted: Tue Jan 01, 2013 8:43 pm
by jassing
Josh wrote: P.S.: Don't mix windows styles between different controls

TextGadget = static control = static style = #SS_CENTER (not #ES_CENTER)
StringGadget = edit control = edit style = #ES_CENTER
Aye... I am using a string gadget + #es_center.

Re: Center Align String - OS Version specific issue?

Posted: Tue Jan 01, 2013 8:50 pm
by RASHAD
Hi Josh
Hi jassing

#ES_CENTER = 1
#SS_CENTER = 1
So both are identical :)

With #EM_SETRECT you can adjust left,right,top & bottom margins as you mentioned
But it will not suit you dynamically like #SS_CENTER if you changed the text for any reason
And for center the text vertically it will be again a headache if you Resized the gadget
But it still a good idea

Re: Center Align String - OS Version specific issue?

Posted: Mon Mar 17, 2014 9:46 am
by SeregaZ
how to make this vertical center with #PB_String_Password? this #PB_String_Password not liked #ES_MULTILINE flag :(

Re: Center Align String - OS Version specific issue?

Posted: Thu Mar 27, 2014 10:56 am
by SeregaZ
and the second problem: when font of gadget is more than 10pt - this code is didn't work :)

how to fix this? this and that problem with password style