[wxruby-users] xml.load_panel

Max Salov lists at ruby-forum.com
Mon Aug 25 09:38:08 EDT 2008


Hello,
I cannot correctly load panel from xrc-file. My test programm is below.
Problem is that panel content is drawn not in place of 'DYMMYPANEL', but
in upper-left corner. Please, help me to find mistake.

#!/usr/bin/ruby -w
require 'wx'
$ui_dir = File.dirname(__FILE__)
class MainFrame < Wx::Frame
  def initialize(parent = nil)
    super
    xrc_file = File.join $ui_dir,'test.xrc'
    xml = Wx::XmlResource.get
    xml.flags = Wx::XRC_NO_SUBCLASSING | Wx::XRC_NO_RELOADING
    xml.init_all_handlers
    xml.load xrc_file
    xml.load_frame_subclass(self,parent,'MAINFRAME')
    @finder = lambda do |x|
      id = Wx::xrcid(x)
      Wx::Window.find_window_by_id(id,self)
    end
    @splitter = @finder.call 'SPLITTER'
    @dummy_panel = @finder.call 'DUMMYPANEL'
    @new_panel = xml.load_panel self,'PANEL'
    @splitter.replace_window @dummy_panel, @new_panel
  end
end
Wx::App.run do
  MainFrame.new.show
end

Attachments:
http://www.ruby-forum.com/attachment/2605/test.xrc

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


More information about the wxruby-users mailing list