[fxruby-users] FXDataTarget: am I doing this fine?

Damián M. González gonzalezdamianm at hotmail.com
Thu Dec 27 10:40:17 UTC 2012

 Hi guys. Have a question to do, been trying to use FXDataTarget to handle a group of #FXLabel showing information. Imagine a group of buttons, each one represents one day in the current month, so will be around 30 of them. When the user press a button, the groups of labels will show information, different depending of which button was pressed last. So the first solution that I though is: "okay... let's make use of FXDataTarget... for the first time". I did something like this:
@data_target = FXDataTarget.new
@buttons = {}
31.times do │time│ @buttons[time] = FXButton.new(some_packer, time.to_s, target: @data_target, selector: FXDataTarget::ID_OPTION.+(time))end
@data_target.connect(SEL_COMMAND) {│sender, selector, data│ some_label.text=(@data_target.value)}
 This doesn't work, in the label appear a nil value, I also printed it in the console, and of course it prints nil. Am I doing something wrong? I expected to the label text change to "1" 'till "31", but doesn't. Thanks for your time. 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/fxruby-users/attachments/20121227/c24886f1/attachment.html>

More information about the fxruby-users mailing list