StringGadget Center Text

Just starting out? Need help? Post your questions and find answers here.
Blankname
Enthusiast
Enthusiast
Posts: 120
Joined: Sun Oct 14, 2012 9:11 am

StringGadget Center Text

Post by Blankname »

How would I go about center aligning the text inside of a StringGadget.

Image
User avatar
skywalk
Addict
Addict
Posts: 4210
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: StringGadget Center Text

Post by skywalk »

Windows snippet only I think...

Code: Select all

Define.i gf
gf = gf|#PB_Text_Center ; text is centered in the gadget.
;gf = gf|#PB_Text_Right  ;  text is right aligned.
;gf = gf|0              ; text is left aligned by default.
mystringgadget_n = StringGadget(#PB_Any, x, y, Wd, Ht, Txt$, gf|#ES_NOHIDESEL)
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
Blankname
Enthusiast
Enthusiast
Posts: 120
Joined: Sun Oct 14, 2012 9:11 am

Re: StringGadget Center Text

Post by Blankname »

skywalk wrote:Windows snippet only I think...

Code: Select all

Define.i gf
gf = gf|#PB_Text_Center ; text is centered in the gadget.
;gf = gf|#PB_Text_Right  ;  text is right aligned.
;gf = gf|0              ; text is left aligned by default.
mystringgadget_n = StringGadget(#PB_Any, x, y, Wd, Ht, Txt$, gf|#ES_NOHIDESEL)
It's a no go, #PB_Text_Center doesn't seem to work.
User avatar
skywalk
Addict
Addict
Posts: 4210
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: StringGadget Center Text

Post by skywalk »

try: StringGadget(1, 10, 45, 150, 20, "-1.234e-12", #ES_CENTER)
EDIT:
Both #ES_CENTER and #PB_TEXT_CENTER = 1 and work for me on PB 5.11, Win7 x86.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
Post Reply