Center Align String - OS Version specific issue?

Windows specific forum
User avatar
Josh
Addict
Addict
Posts: 1183
Joined: Sat Feb 13, 2010 3:45 pm

Re: Center Align String - OS Version specific issue?

Post 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
sorry for my bad english
jassing
Addict
Addict
Posts: 1885
Joined: Wed Feb 17, 2010 12:00 am

Re: Center Align String - OS Version specific issue?

Post 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.
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4955
Joined: Sun Apr 12, 2009 6:27 am

Re: Center Align String - OS Version specific issue?

Post 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
Egypt my love
SeregaZ
Enthusiast
Enthusiast
Posts: 628
Joined: Fri Feb 20, 2009 9:24 am
Location: Almaty (Kazakhstan. not Borat, but Triple G)
Contact:

Re: Center Align String - OS Version specific issue?

Post by SeregaZ »

how to make this vertical center with #PB_String_Password? this #PB_String_Password not liked #ES_MULTILINE flag :(
SeregaZ
Enthusiast
Enthusiast
Posts: 628
Joined: Fri Feb 20, 2009 9:24 am
Location: Almaty (Kazakhstan. not Borat, but Triple G)
Contact:

Re: Center Align String - OS Version specific issue?

Post 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
Post Reply