[fxruby-users] FXRuby, blocks and hash (? should this work}

Melton, Ryan rmelton at ball.com
Sat Feb 9 12:57:33 EST 2008

You overwrote the @cg[:login] hash with a new hash that only contains

The following change should fix it.

@cg[:login] = {:password => FXTextField.new(m, 25)}

@cg[:login][:password] = FXTextField.new(m, 25)

Hope this helps,

-----Original Message-----
From: fxruby-users-bounces at rubyforge.org
[mailto:fxruby-users-bounces at rubyforge.org] On Behalf Of Vladimir Konrad
Sent: Saturday, February 09, 2008 7:27 AM
To: fxruby-users at rubyforge.org
Subject: [fxruby-users] FXRuby, blocks and hash (? should this work}

Example code (:opts omitted)

It is done in initialize of Win < FXMainWinow:

@cg = {}

FXMatrix.new {|m|
  FXLabel.new(m, "Log-in name: ")
  @cg[:login] = {:name => FXTextField.new(m, 25)}

  p @cg[:login][:name].class

  FXLabel.new(m, "Password: ")
  @cg[:login] = {:password => FXTextField.new(m, 25)}

p @cg[:login][:name].class

output is:


The question is, why id disappears?


Please access the attached hyperlink for an important electronic
communications disclaimer:
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