Hi. I'm back. Unfortunately I can't get xrcise working. Here is the sample xrc file and the resulting error messages: =============== TestWxFb.xrc ========================================= <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <resource xmlns="http://www.wxwindows.org/wxxrc" version="2.3.0.1"> <object class="wxFrame" name="MyFrame2" subclass="minFrame"> <style>wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL</style> <size>500,300</size> <title>Minimal</title> <object class="wxBoxSizer"> <orient>wxVERTICAL</orient> <object class="sizeritem"> <option>0</option> <flag>wxALL|wxALIGN_CENTER_HORIZONTAL</flag> <border>5</border> <object class="wxStaticText" name="m_staticText12"> <label>Test</label> </object> </object> <object class="sizeritem"> <option>1</option> <flag>wxEXPAND</flag> <border>5</border> <object class="wxBoxSizer"> <orient>wxHORIZONTAL</orient> <object class="sizeritem"> <option>0</option> <flag>wxALL</flag> <border>5</border> <object class="wxStaticText" name="m_staticText13"> <label>Username</label> </object> </object> <object class="sizeritem"> <option>0</option> <flag>wxALL</flag> <border>5</border> <object class="wxTextCtrl" name="m_textCtrl4"> <value></value> <maxlength>0</maxlength> </object> </object> </object> </object> <object class="sizeritem"> <option>1</option> <flag>wxEXPAND</flag> <border>5</border> <object class="wxBoxSizer"> <orient>wxHORIZONTAL</orient> <object class="sizeritem"> <option>0</option> <flag>wxALL</flag> <border>5</border> <object class="wxStaticText" name="m_staticText14"> <label>MyLabel</label> </object> </object> <object class="sizeritem"> <option>0</option> <flag>wxALL</flag> <border>5</border> <object class="wxTextCtrl" name="m_textCtrl5"> <value></value> <maxlength>0</maxlength> </object> </object> </object> </object> </object> </object> </resource> ========================================================================= xxx:~/Desktop/Eyes$ xrcise -o TestWxFb.rb TestWxFb.xrc /home/myhome/gems/gems/wx_sugar-0.1.22/lib/wx_sugar/xrc/outputter.rb:46:in `clean_id_attr_readers': undefined method `each' for #<String:0x859ff44> (NoMethodError) from (erb):16:in `output' from /opt/lib/ruby1.9/1.9.1/erb.rb:753:in `eval' from /opt/lib/ruby1.9/1.9.1/erb.rb:753:in `result' from /home/myhome/gems/gems/wx_sugar-0.1.22/lib/wx_sugar/xrc/outputter.rb:19:in `output' from /home/myhome/gems/gems/wx_sugar-0.1.22/bin/xrcise:126:in `block (2 levels) in <top (required)>' from /home/myhome/gems/gems/wx_sugar-0.1.22/bin/xrcise:125:in `each' from /home/myhome/gems/gems/wx_sugar-0.1.22/bin/xrcise:125:in `block in <top (required)>' from /home/myhome/gems/gems/wx_sugar-0.1.22/bin/xrcise:124:in `open' from /home/myhome/gems/gems/wx_sugar-0.1.22/bin/xrcise:124:in `<top (required)>' from /home/myhome/gems/bin/xrcise:19:in `load' from /home/myhome/gems/bin/xrcise:19:in `<main>' wxFormbuilder 3.0 wx_sugar version 0.1.22 wxruby-ruby19-2.0.1-x86-linux wx_sugar-0.1.22 Ubuntu version 9.10 (Karmic Koala) =============== .bashrc file ======================================== PATH=/opt/bin:/home/myhome/gems/bin:$PATH LD_LIBRARY_PATH=/opt/lib:$LD_LIBRARY_PATH export GEM_HOME=/home/myhome/gems How do I make xrcise work properly? Thanks. - Philip
on 2009-11-23 03:29
on 2009-11-23 12:25
Hello Philip,
The problem you are having, is the fact that Ruby 1.9 String standard
class
no longer implements the each method on it. Which basically, for
string,
each splits the lines at the \n terminator, returning each line to the
block, so you need to create a library file, and have it included, as
follows:
string_each.rb:
class String
def each
self.split("\n").each do |line|
yield line
end
end
end
Then there's two ways you can work this, either on the command line, do
the
following:
xrcise -rstring_each -o TestWxFb.rb TestWxFb.xrc
Or, modify the xrcise script itself, found in
/home/myhome/gems/gems/wx_sugar-0.1.22/bin/xrcise
And add a require 'string_each' before any other require. I will see
about
fixing this bug, and doing a new release of wx_sugar to fix this problem
with Ruby 1.9, along with any other outstanding bugs that I can find in
regards to wx_sugar.
hth,
Mario
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.