Forum: wxRuby wxRuby menu item checkbox

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
981557a6a5f05a7b96e9a4fea2a6ccb1?d=identicon&s=25 Gary Hasson (gary2594)
on 2010-03-29 05:26
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

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.
2aa32559134aa3d596fb749f8ffccde7?d=identicon&s=25 hendra kusuma (Guest)
on 2010-03-29 10:47
(Received via mailing list)
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,,400),

        @menu_bar_101 =
        @menu_coba ="&Coba", 0)
        @menu_check =, 103, "coba 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 =, -1)
        @btn_is_checked =, -1, "checked",

        evt_button(@btn_is_checked) { |event|
btn_is_checked_click(event) }

        evt_close{ |event| on_close(event) }

    def btn_is_checked_click(event)
        puts "checked" if @menu_check.is_checked
D30b41d7e3cdfe24b356631940d85794?d=identicon&s=25 Pierpaolo Giordani (pierp)
on 2010-03-29 17:50
(Received via mailing list)
Hi list!
I worked with wxWidgets in C++, and now I'd like to play with wxruby.
But, with a minimal app like this...

require "rubygems"
require "wx"
include Wx
class Minima < App
    def on_init, -1, "Applicazione minima").show()

... I get "Segmentation fault":
[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/

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!
3396e4a3df8a840faec520af8555a400?d=identicon&s=25 Mario Steele (Guest)
on 2010-03-29 23:59
(Received via mailing list)
Is this a Gem install of wxRuby on your OS, or are you compiling from

On Mon, Mar 29, 2010 at 6:31 AM, Pierpaolo Giordani <
3396e4a3df8a840faec520af8555a400?d=identicon&s=25 Mario Steele (Guest)
on 2010-03-30 00:01
(Received via mailing list)

Never mind, just re-read the error message, and your specs.

Three things of note here.  First, the Gem that you have installed is
on Ubuntu, and may have problems on Red Hat Linux and Derivatives.
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
compiling process with C++, and wxWidgets.  Take a look at our wiki,
specifically under "How to build wxRuby", for instructions on how to
wxWidgets, and wxRuby.

My best suggestion for this kind of situation, is that if CentOS' repos
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
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.


D30b41d7e3cdfe24b356631940d85794?d=identicon&s=25 Pierpaolo Giordani (pierp)
on 2010-03-30 16:00
(Received via mailing list)
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/ cannot open shared object file: No such file
or directory - /usr/lib64/ruby/site_ruby/1.8/x86_64-linux/
  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/
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:
D30b41d7e3cdfe24b356631940d85794?d=identicon&s=25 Pierpaolo Giordani (pierp)
on 2010-03-30 16:46
(Received via mailing list)
I don't have! 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
3396e4a3df8a840faec520af8555a400?d=identicon&s=25 Mario Steele (Guest)
on 2010-03-30 20:22
(Received via mailing list)
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
that will install the library.  The .a library is
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 <
981557a6a5f05a7b96e9a4fea2a6ccb1?d=identicon&s=25 Gary Hasson (gary2594)
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.


D30b41d7e3cdfe24b356631940d85794?d=identicon&s=25 Pierpaolo Giordani (pierp)
on 2010-03-31 11:40
(Received via mailing list)
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
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:
3396e4a3df8a840faec520af8555a400?d=identicon&s=25 Mario Steele (Guest)
on 2010-03-31 15:17
(Received via mailing list)
Your welcome.

On Wed, Mar 31, 2010 at 5:35 AM, Pierpaolo Giordani <
This topic is locked and can not be replied to.