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

Marlene Phillips marlene at phillipses.com
Fri Jun 19 13:50:32 EDT 2009


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,
      :opts => JUSTIFY_RIGHT|JUSTIFY_BOTTOM|ICON_BEFORE_TEXT)
    label2 = FXLabel.new(self, "sunken label", :opts => JUSTIFY_BOTTOM)
    show(PLACEMENT_SCREEN)
  end
end


if __FILE__ == $0
  FXApp.new do |app|
    Marlene1.new(app)
    app.create
    app.run
  end
end

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.

Thanks!

Marlene Phillips




More information about the fxruby-users mailing list