I am playing around with making some sort of GUI in ruby and have settle
on wxRuby. I stumbled across wxSugar and the sample code here: http://wxruby.rubyforge.org/wiki/wiki.pl?WxSugar
but that code does not run!?
It is saying that all the methods associated with Wx::Choice that he
uses (each_string, strings[], data[], delete_if) do not exist and I have
no clue why. I cannot find ANY documentation on wxSugar so I’m not sure
how I’m supposed to pick it up.
Also, in that example code he adds Wx::Choice and a Wx::TextCtrl, but
how can I get to the data in these controls? I know the method is
something like choice.get_current_selection(), but how do I reference it
anywhere if it has no identifier or name? For example if I selected
something from the Wx::Choice and I want that selection to print to the
screen when I click a button, how do I access that selection in the
button code?
Also, in that example code he adds Wx::Choice and a Wx::TextCtrl, but
how can I get to the data in these controls? I know the method is
something like choice.get_current_selection(), but how do I reference it
anywhere if it has no identifier or name? For example if I selected
something from the Wx::Choice and I want that selection to print to the
screen when I click a button, how do I access that selection in the
button code?
It is saying that all the methods associated with Wx::Choice that he
uses (each_string, strings[], data[], delete_if) do not exist and I have
no clue why.
Apologies, these methods in the development version but not in current
release. Take a look at samples/sugar_sample.rb as a starting point.
I’ve updated the Wiki so it’s not out of line.
I cannot find ANY documentation on wxSugar so I’m not sure
how I’m supposed to pick it up.
You should find reasonably thorough RDoc documentation installed with
the gem, or have a look at lib/wx_sugar.rb for an overview of the
functionality.
Also, in that example code he adds Wx::Choice and a Wx::TextCtrl, but
how can I get to the data in these controls? I know the method is
something like choice.get_current_selection(), but how do I reference it
anywhere if it has no identifier or name? For example if I selected
something from the Wx::Choice and I want that selection to print to the
screen when I click a button, how do I access that selection in the
button code?
This is probably more a question about object-oriented design of GUI
apps, and of event handling in particular. As others have suggested, the
wxruby-users list is likely the best place to discuss how this is done
in wxruby.
cheers
alex
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.