[wxruby-users] xrcise question
Mario Steele
mario at ruby-im.net
Sat Nov 15 23:57:30 EST 2008
Try changing the line for the loading of the XML resource file from:
xml.load("wxFormBuilder\noname.xrc")
To:
xml.load("wxFormBuilder/noname.xrc")
Thankfully, to Ruby and wxWidgets, it doesn't really need you to use the \
slash to access a file path.
Often times, it's better to run xrcise as such:
xrcise -o noname.rb wxFormBuilder/noname.xrc
This way, doesn't matter if it's on Windows, or Linux, it will be able to
find the resources just fine.
On Sat, Nov 15, 2008 at 3:11 PM, Heinrich Piard <lists at ruby-forum.com>wrote:
> Hello,
>
> here is my code. Is still can't get it to work.
>
>
> # This class was automatically generated from XRC source. It is not
> # recommended that this file is edited directly; instead, inherit from
> # this class and extend its behaviour there.
> #
> # Source file: wxFormBuilder\nonam.xrc
> # Generated at: Fri Nov 14 17:16:34 -0500 2008
>
> require 'wx'
> include Wx
>
> class CometApplication < Wx::Frame
>
> attr_reader :m_statusbar1, :m_toolbar1, :m_textctrl1, :m_button2,
> :m_button3
>
> def initialize(parent = nil)
> super()
> xml = Wx::XmlResource.get
> xml.flags = 2 # Wx::XRC_NO_SUBCLASSING
> xml.init_all_handlers
> xml.load("wxFormBuilder\nonam.xrc")
> xml.load_frame_subclass(self, parent, "MyFrame1")
>
> finder = lambda do | x |
> int_id = Wx::xrcid(x)
> begin
> Wx::Window.find_window_by_id(int_id, self) || int_id
> # Temporary hack to work around regression in 1.9.2; remove
> # begin/rescue clause in later versions
> rescue RuntimeError
> int_id
> end
> end
>
> @m_statusbar1 = finder.call("m_statusBar1")
> @m_toolbar1 = finder.call("m_toolBar1")
> @m_textctrl1 = finder.call("m_textCtrl1")
> @m_button2 = finder.call("m_button2")
> @m_button3 = finder.call("m_button3")
> if self.class.method_defined? "on_init"
> self.on_init()
> end
> end
> end
>
> class MyApp < App
> def initialize()
> CometApplication.new
> end
> end
> MyApp.new.main_loop()
>
> I start the code from C:\ruby\ruby_scripts\test.rb and the xrc file is
> in C:\ruby\ruby_scripts\wxFormBuilder\nonam.xrc
>
>
>
> --
> 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
http://www.trilake.net
http://www.ruby-im.net
http://rubyforge.org/projects/wxruby/
http://rubyforge.org/projects/wxride/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/wxruby-users/attachments/20081115/def6220f/attachment.html>
More information about the wxruby-users
mailing list