[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Help with wxSugar please

Alex Ciarlillo

3/28/2007 7:09:00 PM

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....
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?

thanks
-alex

--
Posted via http://www.ruby-....

2 Answers

Alec Ross

3/28/2007 7:23:00 PM

0

In message <e4296dc201e33bdf5ab084fe8d86e2d4@ruby-forum.com>, Alex
Ciarlillo <ac251404@ohio.edu> writes
>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....
>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?
>
>thanks
>-alex
>
Question for: wxruby-users@rubyforge.org ?

Regards,

Alec
--
Alec Ross

Alex Fenton

3/28/2007 10:59:00 PM

0

Hi Alex

Alex Ciarlillo wrote:
> 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