I am using wxFormBuilder version 3.0.57 to produce an xrc file for my wxRuby GUI. I have used this successfully for some time now. However, I have been unable to get a checkbox menu item to function the way that I expect it to. That is, when I try to test if the box is checked, as described in the wxRuby doc's, it generates an error stating that .is_checked is not a method. I am doing all of this exactly the same way as I work with non-menu checkboxes. What is the problem here? Sample code: puts @my_menuitem_checkbox.is_checked Error message: undefined method `is_checked' for 120:Fixnum (NoMethodError) Note: the 120 in the error message is the ID for @my_menuitem_checkbox. Platform: Ubuntu 9.04 (32bit), Ruby 1.8.7, everything is up to date.
on 2010-03-29 05:26
on 2010-03-29 10:47
My code runs just ok
for test, I make my form like this
I don't know how you make yours
but I hope this help
require 'rubygems'
require 'wx'
class Coba_b < Wx::Frame
def initialize(parent=nil)
super parent, -1, "Coba", DEFAULT_POSITION, Size.new(600,400),
DEFAULT_FRAME_STYLE
@menu_bar_101 = MenuBar.new(0)
@menu_coba = Menu.new("&Coba", 0)
@menu_check = MenuItem.new(@menu_coba, 103, "coba check", "",
ITEM_CHECK)
@menu_coba.append_item(@menu_check)
evt_menu(103) { |event| menu_check_call(event) }
@menu_bar_101.append(@menu_coba, "&Coba")
self.set_menu_bar @menu_bar_101
@panel_104 = Panel.new(self, -1)
@btn_is_checked = Button.new(@panel_104, -1, "checked",
DEFAULT_POSITION, DEFAULT_SIZE, 0, DEFAULT_VALIDATOR )
evt_button(@btn_is_checked) { |event|
btn_is_checked_click(event) }
evt_close{ |event| on_close(event) }
on_load()
end
def btn_is_checked_click(event)
puts "checked" if @menu_check.is_checked
end
end
on 2010-03-29 17:50
Hi list!
I worked with wxWidgets in C++, and now I'd like to play with wxruby.
But, with a minimal app like this...
#!/usr/bin/ruby
require "rubygems"
require "wx"
include Wx
class Minima < App
def on_init
Frame.new(nil, -1, "Applicazione minima").show()
end
end
Minima.new.main_loop
... I get "Segmentation fault":
/usr/lib/ruby/gems/1.8/gems/wxruby-2.0.1-x86-linux/lib/wx/keyword_ctors.rb:168:
[BUG] Segmentation fault
ruby 1.8.5 (2006-08-25) [i386-linux]
Running it with gdb:
Program received signal SIGSEGV, Segmentation fault.
0x002e11e8 in wcslen () from /lib/libc.so.6
My sistem is:
Linux CentOS 5.4 updated
Ruby 1.8.5
wxGTK, wxBase and wxGTK-gl installed from distro (2.8.9-2.el5)
Thanks for help!
on 2010-03-29 23:59
Is this a Gem install of wxRuby on your OS, or are you compiling from source? On Mon, Mar 29, 2010 at 6:31 AM, Pierpaolo Giordani <
on 2010-03-30 00:01
Actually, Never mind, just re-read the error message, and your specs. Three things of note here. First, the Gem that you have installed is built on Ubuntu, and may have problems on Red Hat Linux and Derivatives. Second, wxRuby is built against Ruby 1.8.7, and there may be incompatibilities between 1.8.5 in the C back-end, compared to 1.8.7. And the final note here, is that it seems you are familiar with the whole compiling process with C++, and wxWidgets. Take a look at our wiki, specifically under "How to build wxRuby", for instructions on how to build wxWidgets, and wxRuby. My best suggestion for this kind of situation, is that if CentOS' repos do not have the latest version of Ruby available, then I would compile Ruby 1.8.7 from source, and install that. Then ensure that wxWidgets is at least 2.8.10. If it isn't, then grab wxWidgets, and compile that from source, following the instructions on our Wiki, then finally build wxRuby. hth, Mario
on 2010-03-30 16:00
I don't really need wxruby on CentOS, because the final destination is fedora 12 x86_64. So I compiled wxWidgets with the suggested options (and the patch for recent GTK+ versions) on fedora. All ok. Then I downgraded swig to 1.3.34 and compiled wxruby and the contrib add. All seems ok - no errors. Rebuild of ruby is very hard (you need a patch for openssl 1.0, but I found half a dozen of patches and I don't know the rigth one) - I'll try the pre-build ruby 1.8.6 (2009-08-04 patchlevel 383), for now. When I launch my miniml app this is the output: /usr/lib64/ruby/site_ruby/1.8/x86_64-linux/wxruby2.so: libwx_gtk2u_stc-2.8.so.0: cannot open shared object file: No such file or directory - /usr/lib64/ruby/site_ruby/1.8/x86_64-linux/wxruby2.so (LoadError) from /usr/lib/ruby/site_ruby/1.8/wx.rb:12 from ./minima.rb:3:in `require' from ./minima.rb:3 but there is a /usr/lib64/ruby/site_ruby/1.8/x86_64-linux/wxruby2.so file! (55M , read and execute permissions for all). I'm confused. Pierpaolo Giordani Il giorno lun, 29/03/2010 alle 17.55 -0400, Mario Steele ha scritto:
on 2010-03-30 16:46
I don't have libwx_gtk2u_stc-2.8.so.0! Instead I have /usr/local/lib/libwx_gtk2u_stc-2.8.a Pierpaolo Giordani Il giorno mar, 30/03/2010 alle 16.00 +0200, Pierpaolo Giordani ha scritto:
on 2010-03-30 20:22
Make sure that you go into your contrib folder, as described in the Wiki, to compile STC into a Shared Library. Make sure to run make, and make install, that will install the libwx_gtk2u_stc.so library. The .a library is just the assembly for the compiled code, to be statically linked into any executable, or library that is compiled against it. On Tue, Mar 30, 2010 at 10:24 AM, Pierpaolo Giordani <
on 2010-03-30 23:11
Dear Pierpaolo Giordani and Mario Steele: I posted this topic: "wxRuby menu item checkbox" because I needed help with a specific wxRuby - wxFormBuilder problem. The Segmentation fault issue posted by Pierpaolo Giordani (pierp) on 29.03.2010 17:50 should never have been placed inside the "wxRuby menu item checkbox" topic, since it is not related. But the two of you have continued to use the "wxRuby menu item checkbox" topic for addressing an unrelated topic, which has resulted in my not getting any suitable answers to the topic that I posted. I would appreciate your moving your issue to its own topic. Thanks, Gary
on 2010-03-31 11:40
Solved! Just for fedora 12-64bit users, this is the roadmap: yum erase wxGTK wxBase yum install gstreamer-devel gstreamer-plugins-base-devel ruby-gstreamer-devel ruby-gconf2-devel mesa-libGL-devel mesa-libGLU-devel ruby-gconf2-devel (not sure if they are all useful) Download wxWidgets, extract in a folder, and copy the patch for GTK+ Create a build-wxruby folder inside the wxWidgets folder In build-wxruby, give this command: ../configure --disable-shared --with-gtk --enable-monolithic --enable-unicode --disable-debug --enable-catch_segvs --enable-graphics_ctx --enable-mediactrl --with-opengl --with-libjpeg=builtin --with-libpng=builtin --with-libtiff=builtin --with-zlib=builtin --with-expat=builtin --enable-gui --enable-xrc --enable-mdi --enable-gif --enable-pcx --enable-iff --enable-pnm --enable-xpm CFLAGS=-fPIC CXXFLAGS=-fPIC LDFLAGS=-fPIC then make and make install (be root) move to ....contrib/src/stc, then make and make install yum erase swig Download and install swig 1.3.34 Download wxruby, then rake and rake install thanks Mario! Il giorno mar, 30/03/2010 alle 13.54 -0400, Mario Steele ha scritto:
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.