Hello. I have a ruby 1.9 and create a file trap.xrc in DialogBlocks. Later I create a trap.rb: xrcise -o trap.rb trap.xrc ... All good. But late I create a file ed.rb: ------- require ''wx'' require ''trap'' class Exsys < wxFrame def initialize super end end Wx::App.run do Exsys.new.show end ------- It doesn''t work! Why? Please open attached image ''xx.jpg'', here wrote error. Attachments: http://www.ruby-forum.com/attachment/5223/xx.jpg -- Posted via http://www.ruby-forum.com/.
I believe your using Ruby 1.9.2, and if so, it no longer references the current directory, or rather the directory from where the script is launched from, as a path in which to look for files to require in. You can do one of two things, you can either do: require ''wx'' require ''./trap'' or you could do: $:.unshift "." requrie ''wx'' require ''trap'' Either of these methods will work to get trap.rb to load up under 1.9.2. This isn''t so much a wxRuby Problem, as it is a design change by Ruby 1.9 core. hth, Mario On Mon, Oct 18, 2010 at 7:43 PM, Misha Ognev <lists at ruby-forum.com> wrote:> Hello. > > I have a ruby 1.9 and create a file trap.xrc in DialogBlocks. > > Later I create a trap.rb: xrcise -o trap.rb trap.xrc ... All good. > > But late I create a file ed.rb: > > ------- > > require ''wx'' > require ''trap'' > > class Exsys < wxFrame > def initialize > super > end > end > > Wx::App.run do > Exsys.new.show > end > > ------- > > It doesn''t work! Why? > > Please open attached image ''xx.jpg'', here wrote error. > > Attachments: > http://www.ruby-forum.com/attachment/5223/xx.jpg > > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users >-- Mario Steele Lieutenant Commander 3 XO - Geo 99 XO - STO IFT Fleet http://www.trekfederation.com http://geo99.ruby-im.net -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/wxruby-users/attachments/20101018/f214d3eb/attachment.html>
Thanks, Mario! Now I have else three problems. 1) I create an XRC file with a label, combobox and button ---------- XRC <?xml version="1.0" encoding="UTF-8"?> <resource version="2.3.0.1" xmlns="http://www.wxwidgets.org/wxxrc"> <object class="wxFrame" name="ID_WXFRAME" subclass="TFB"> <style>wxCAPTION|wxSYSTEM_MENU|wxCLOSE_BOX</style> <size>640,480</size> <title>FFF</title> <centered>1</centered> <object class="wxBoxSizer"> <orient>wxVERTICAL</orient> <object class="sizeritem"> <flag>wxALIGN_CENTER_HORIZONTAL|wxTOP</flag> <border>220</border> <object class="wxStaticText" name="wxID_STATIC"> <label>Check your location</label> </object> </object> <object class="sizeritem"> <flag>wxALIGN_CENTER_HORIZONTAL|wxALL</flag> <border>5</border> <object class="wxComboBox" name="where_are_you"> <size>100,-1</size> <style>wxCB_DROPDOWN</style> <content> <item>USA</item> <item>Canada</item> </content> </object> </object> <object class="sizeritem"> <flag>wxALIGN_CENTER_HORIZONTAL|wxALL</flag> <border>5</border> <object class="wxButton" name="next_btn"> # HERE <label>Next</label> </object> </object> </object> </object> </resource> ----------- RB # -*- coding: utf-8 -*- require ''wx'' require ''./trap'' class Exsys < TFB def initialize super evt_button (next_btn) {next_go} # HERE end end def next_go # Many Testing Code end Wx::App.run do Exsys.new.show() end -------- I need to start an def next_go, if I click button next_btn (see HERE places in the code). It doesn''t work, see the attached image. 2) How I can read a value from ComboBox? 3) How I can disable and enable Sizer? Attachments: http://www.ruby-forum.com/attachment/5227/xxy.jpg -- Posted via http://www.ruby-forum.com/.
Hello Michael, On Tue, Oct 19, 2010 at 5:54 AM, Misha Ognev <lists at ruby-forum.com> wrote:> Thanks, Mario! Now I have else three problems. > > 1) I create an XRC file with a label, combobox and button > > ---------- XRC > > <?xml version="1.0" encoding="UTF-8"?> > <resource version="2.3.0.1" xmlns="http://www.wxwidgets.org/wxxrc"> > <object class="wxFrame" name="ID_WXFRAME" subclass="TFB"> > <style>wxCAPTION|wxSYSTEM_MENU|wxCLOSE_BOX</style> > <size>640,480</size> > <title>FFF</title> > <centered>1</centered> > <object class="wxBoxSizer"> > <orient>wxVERTICAL</orient> > <object class="sizeritem"> > <flag>wxALIGN_CENTER_HORIZONTAL|wxTOP</flag> > <border>220</border> > <object class="wxStaticText" name="wxID_STATIC"> > <label>Check your location</label> > </object> > </object> > <object class="sizeritem"> > <flag>wxALIGN_CENTER_HORIZONTAL|wxALL</flag> > <border>5</border> > <object class="wxComboBox" name="where_are_you"> > <size>100,-1</size> > <style>wxCB_DROPDOWN</style> > <content> > <item>USA</item> > <item>Canada</item> > </content> > </object> > </object> > <object class="sizeritem"> > <flag>wxALIGN_CENTER_HORIZONTAL|wxALL</flag> > <border>5</border> > <object class="wxButton" name="next_btn"> # HERE > <label>Next</label> > </object> > </object> > </object> > </object> > </resource> > > ----------- RB > > # -*- coding: utf-8 -*- > require ''wx'' > require ''./trap'' > > class Exsys < TFB > def initialize > super > evt_button (next_btn) {next_go} # HERE > end > end > > > def next_go > # Many Testing Code > end > > > Wx::App.run do > Exsys.new.show() > end > > -------- > > I need to start an def next_go, if I click button next_btn (see HERE > places in the code). It doesn''t work, see the attached image. >The next_btn should actually be accessable through @next_btn, since you are inheriting the TFB class in your Exsys class. Try doing: evt_button(@next_btn) { next_go }> 2) How I can read a value from ComboBox? >See http://wxruby.rubyforge.org/doc/combobox.html Specifically #get_value and #get_current_selection. Since ComboBox has a TextEntry and a Choice setup with it, you need to compare between the TextEntry and Choice to ensure you are getting the correct value out of it.> 3) How I can disable and enable Sizer? >First you need to get the sizer, by using Window#get_containing_sizer, then you can use Window#hide, or Window#show to hide/show a Sizer, and Window#disable or Window#enable to disable/enable a set of controls. There''s no physical way to disable a Sizer to prevent the sizer from resizing in the window. You can only either hide / show it, or enable/disable the controls within it.> Attachments: > http://www.ruby-forum.com/attachment/5227/xxy.jpg > > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users >hth, Mario -- Mario Steele Lieutenant Commander 3 XO - Geo 99 XO - STO IFT Fleet http://www.trekfederation.com http://geo99.ruby-im.net -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/wxruby-users/attachments/20101019/a8b0be87/attachment.html>
Mario, I do what you say. This is new error in 1): see attached please. Attachments: http://www.ruby-forum.com/attachment/5228/yy.jpg -- Posted via http://www.ruby-forum.com/.
Why everybody silent? -- Posted via http://www.ruby-forum.com/.
Sorry Michael, I tend to not get much time to respond to emails, as I''m trying to run through everything. Could you send me attached a copy of your XRC, and Ruby Source files, so I can see where the problem may be in the code? Thanks, Mario On Fri, Oct 22, 2010 at 4:49 PM, Misha Ognev <lists at ruby-forum.com> wrote:> Why everybody silent? > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users >-- Mario Steele Lieutenant Commander 3 XO - Geo 99 XO - STO IFT Fleet http://www.trekfederation.com http://geo99.ruby-im.net -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/wxruby-users/attachments/20101023/c3ec06ee/attachment-0001.html>
Mario, here this files: http://www.sendspace.com/file/q93zj9 The first button, Ctrl-C, must copy text frim label to textctrl. The second button must hide sizer which parent to textctrl on the first click, and in the second show it. Thanks, Michael. -- Posted via http://www.ruby-forum.com/.