Page 1 of 1

Vertical font alignment - not available in text gadgets ?

Posted: Wed Jan 27, 2016 11:14 am
by agb2008
Just another quick question - when I use text gadgets it seems that there is no
option to align text - so that it would be centered in terms of vertical alignment -
am I correct ? Text would be displayed at the top of gadget... Same thing happens
for string gadgets. Any possible workaround ?

Re: Vertical font alignment - not available in text gadgets

Posted: Wed Jan 27, 2016 11:54 am
by TI-994A
agb2008 wrote:...there is no option to align text - so that it would be centered in terms of vertical alignment - am I correct ? ... Any possible workaround ?
Yes, you are correct. :wink:

As for workarounds, there are many offered in this forum. Here's a fairly old one, recently infused with some new suggestions:

>> StringGadget Vertical

Re: Vertical font alignment - not available in text gadgets

Posted: Wed Jan 27, 2016 12:18 pm
by RSBasic
Vertical align (center) for TextGadget:

Code: Select all

EnableExplicit

If OpenWindow(0, 0, 0, 500, 400, "Window", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  TextGadget(1, 10, 10, 480, 400, "Lorem ipsum dolor sit amet, consectetuer adipiscing elit.", #SS_CENTERIMAGE)
  
  Repeat
    Select WaitWindowEvent()
      Case #PB_Event_CloseWindow
        End
    EndSelect
  ForEver
EndIf

Re: Vertical font alignment - not available in text gadgets

Posted: Wed Jan 27, 2016 12:57 pm
by TI-994A
RSBasic wrote:

Code: Select all

TextGadget(1, 10, 10, 480, 400, "Lorem ipsum dolor sit amet, consectetuer adipiscing elit.", #SS_CENTERIMAGE)
It should be noted that the SS_CENTERIMAGE flag is a Windows-only style setting, which only works with the TextGadget(), and not the StringGadget().

Re: Vertical font alignment - not available in text gadgets

Posted: Wed Jan 27, 2016 3:18 pm
by agb2008
TI-994A, RSBasic:

Thank you for your suggestions ! A bit strange that this option is not available in PB... :?