|
Object Oriented PHP-GTK2 - Aligning Labels Naturally
Object Oriented PHP-GTK2 - Aligning Labels Naturally
|
||||
|
OOPS Site
Compile
Aligning Labels NaturallyAlign them without GtkAlignment containers. Topic: GtkLabel (View All Tutorials) This is perhaps one of the most simple tutorial topics I could possibly think of... but you have no idea how long this has eluded me, and I would end up taking the hard way to aligning the text in my labels. I was just asked about doing this the other day, so thankfully I was not the only one staring the manual point blank and just not seeing it. The method we need is the set_alignment() from one of GtkLabel's parent classes, GtkMisc. It takes two argument, an X float and a Y float. To do this, know that 0 0 is top left, and 1 1 is bottom right. The default behaviour is to float the text smack in the middle when the label is larger than the text it contains. See It Quick
More Generic ExamplesThese generic examples work well, for instance if you needed a label to stretch with the window, remain right aligned against a GtkEntry and also stay vertically centred on it, you would want the generic right align.
Demo Application
End GameWas this document helpful? I appreciate your feedback. i can has web two point ooh // copyright © 2007-2008 bob majdak jr
[ xhtml css | firefox ie7 opera ] |
||||