Have you, or do you know if anyone else has, produced an FXRuby for TK
users yet? That example I posted [Ruby-Talk:45298] which caused Ruby Tk
to blow up -- I'd like to try translating it to FXRuby. A quick rush
through the user guide didn't turn up much about entry widgets or label
widgets, which are the ones I need for this.
As far as I know, no one has written an "FXRuby for Tk Users" tutorial. But
I can give you a brief rundown of FOX's equivalents of Tk's Button, Entry,
and Label widgets.
The FOX button widget is called FXButton, and the "button.rb" example
program included with FXRuby shows off most everything you can do with them.
As with most FOX widgets, the FXButton#initialize method takes a large
number of arguments, but most of them have default values. To keep it
simple, start out with a button that just displays a label:
pigButton = FXButton.new(parent, "Pig It")
and to connect that button to a message handler, use the FXButton#connect
The FOX equivalent of Tk's Entry widget is the FXTextField. For your program
you'll want to combine them with data targets, FOX's equivalent of Tk's
@host = FXDataTarget.new("") # for a string
@host_entry = FXTextField.new(parent, 8,
If you want to turn on "password" mode, where the user's input is masked by
asterisks, enable the TEXTFIELD_PASSWD mode for the text field:
@passwd = FXDataTarget.new("") # for a string
@pass_entry = FXTextField.new(parent, 8,
Finally, FOX's equivalent of the Tk Label is (you guessed it) called FXLabel:
myLabel = FXLabel.new(parent, "Remote Host:")
My advice would be to run through some of the examples included with FXRuby
and pick one that's close to the program you're designing, and then try
incrementally modifying that program to see what happens as you change it.
Luckily, Ruby makes this easy
Can I suggest that you link the filenames in chapter 2 (Examples) to the
actual code, so that we can see how to use these widgets, please?
Yes, this is a good suggestion. I will make a note to do this for the next
Hope this helps,
On Thu, 25 Jul 2002 11:59:53 +0100 (BST), Hugh Sasse Staff Elec Eng <firstname.lastname@example.org> wrote :