You overwrote the @cg[:login] hash with a new hash that only contains
:password.
The following change should fix it.
Was:
@cg[:login] = {:password => FXTextField.new(m, 25)}
Is:
@cg[:login][:password] = FXTextField.new(m, 25)
Hope this helps,
Ryan
-----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)}
@cg[:login][:name].setFocus
p @cg[:login][:name].class
FXLabel.new(m, "Password: ")
@cg[:login] = {:password => FXTextField.new(m, 25)}
}
p @cg[:login][:name].class
output is:
Fox::FXTextField
NilClass
The question is, why id disappears?
Vlad
Please access the attached hyperlink for an important electronic
communications disclaimer:
http://www.lse.ac.uk/collections/secretariat/legal/disclaimer.htm
_______________________________________________
fxruby-users mailing list
fxruby-users at rubyforge.orghttp://rubyforge.org/mailman/listinfo/fxruby-users
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.