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.
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)
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.
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 <
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 S. ha scritto:
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 S. ha scritto:
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
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.