[fxruby-users] New to FXRuby Can't justify a label

Melton, Ryan rmelton at ball.com
Fri Jun 19 13:57:56 EDT 2009

Some thoughts:

Height and width of the label do nothing unless you give the LAYOUT_FIX_WIDTH and/or LAYOUT_FIX_HEIGHT options.

You are not using a layout manager (FXVerticalFrame, etc.), so you get the default layout of the FXMainWindow which acts like a vertical frame stacking windows from the top left down.

Justification only applies within the labels height/width so it can't do anything if the FXLabel is auto sized to be only the size of its text (which is what is happening).  Try using LAYOUT_BOTTOM to move it to the bottom of the FXMainWindow.


-----Original Message-----
From: fxruby-users-bounces at rubyforge.org [mailto:fxruby-users-bounces at rubyforge.org] On Behalf Of Marlene Phillips
Sent: Friday, June 19, 2009 11:51 AM
To: fxruby-users at rubyforge.org
Subject: [fxruby-users] New to FXRuby Can't justify a label

I'm trying to wrap my head around Ruby, FXRuby, etc., getting back into
programming after 15+ years away.

Went through the Pragmatic Programmer tutorial chapters, now trying to
justify a label in a simple main window. I'm obviously missing something basic.

code is here:

require 'fox16'
include Fox

class Marlene1 < FXMainWindow
  def initialize(app)
    super(app, "Second window", :width=>600, :height=>400)
    label_icon = FXJPGIcon.new(app, File.open("mlp.jpg", "rb").read)
    label = FXLabel.new(self, "This is a label", :icon => label_icon,
    label2 = FXLabel.new(self, "sunken label", :opts => JUSTIFY_BOTTOM)

if __FILE__ == $0
  FXApp.new do |app|

No matter what I do, I can't get the label to the bottom of the window
(or any kind of justification, for that matter.) I put the icon in so I
could play with moving the label around. I tried
changing the height and width of the label, no luck. I tried creating
the label in an FXMatrix child window, and that was even worse - the
labels and icons
disappeared altogether until I resized the main window - then all of a
sudden they all appeared again, but still not justified.

What am I missing here? I'd sure appreciate help.


Marlene Phillips

fxruby-users mailing list
fxruby-users at rubyforge.org

This message and any enclosures are intended only for the addressee.  Please  
notify the sender by email if you are not the intended recipient.  If you are  
not the intended recipient, you may not use, copy, disclose, or distribute this  
message or its contents or enclosures to any other person and any such actions  
may be unlawful.  Ball reserves the right to monitor and review all messages  
and enclosures sent to or from this email address.

More information about the fxruby-users mailing list