I was trying to figure out what the correct parameters are for
ScrolledWindow.new.
In the doc I saw some detrails
(http://wxruby.rubyforge.org/doc/scrolledwindow.html#ScrolledWindow_new)
but I still couldnt see what I was doing wrong.
So I looked at the sources for the gem, and found no explicit definition
of the class and methods, but a mention of wxruby2, the ‘binary
library’. What’s that?
Then looking deeper I found the wxruby2 gem’s sources, where again no
explicit mention about ScrolledWindow.new. It looks to me like wxruby2
is a ruby “api” to the underlying c library. There’s mention of Swig,
what’s that?
And then within wxruby2/swig/classes/scrolledwindow.i I find this
inscrutable stuff (see below)… Does that somehow explain what the
RUBY parameters are for ScrolledWindow?
I think I am almost but not grasping the mapping. Can anyone clarify or
point me to a clarification? Thanks!
Pito
----- Referenced above -----
// Copyright 2004-2008, wxRuby development team
// released under the MIT-like wxRuby2 license
%include “…/common.i”
%{
#include <wx/scrolwin.h>
%}
%module(directors=“1”) wxScrolledWindow
GC_MANAGE_AS_WINDOW(wxScrolledWindow);
SWIG_WXWINDOW_NO_USELESS_VIRTUALS(wxScrolledWindow);
%apply int * OUTPUT { int * }
%import “include/wxObject.h”
%import “include/wxEvtHandler.h”
%import “include/wxWindow.h”
%import “include/wxPanel.h”
%include “include/wxScrolledWindow.h”
On Wednesday 29 April 2009, Pito S. wrote:
|
|Then looking deeper I found the wxruby2 gem’s sources, where again no
|explicit mention about ScrolledWindow.new. It looks to me like wxruby2
|is a ruby “api” to the underlying c library. There’s mention of Swig,
|what’s that?
You’re right, wxruby2 is a ruby binding to the WxWidgets C++ library
(http://wxwidgets.org/). Swig (http://www.swig.org/) is a tool which
makes
eaiser to generate bindings from C(++) to several other language,
including
ruby by automatically create some of the code needed to do so. The
scrolledwindow.i file you mention below is one of the files needed by
Swig
and, if I’m not mistaken (I’ve never used Swig myself) it plays a role
similar
to those of .h files in C.
As for your problem, I think the wxwidgets web site may have some more
documentation, but it will be for C++, so there will be differences from
ruby.
Other than that, you can ask on the wxruby mailing list
(http://wxruby.rubyforge.org/wiki/wiki.pl?MailingLists), or even here.
In any
case, you’ll need to post the code which causes the problem, or at least
explain what the problem is and post any error message you think
relevant.
I hope this helps
Stefano
Pito S. wrote:
I was trying to figure out what the correct parameters are for
ScrolledWindow.new.
In the doc I saw some detrails
(http://wxruby.rubyforge.org/doc/scrolledwindow.html#ScrolledWindow_new)
but I still couldnt see what I was doing wrong.
The parameters in the docs are correct I think. After you create the
ScrolledWindow you need to set up the scroll bars (eg using
set_virtual_size and set_scroll_rate) as described at the top of the doc
page.
There are examples of using ScrolledWindow in the samples (though the
sample is a bit over-elaborate), or here:
http://weft-qda.rubyforge.org/svn/trunk/weft-qda/lib/weft/wxgui/controls/image_viewer.rb
As Stefan says, you can get help on the mailing list if you post some
code, and a description of an error message or what’s not working.
So I looked at the sources for the gem, and found no explicit definition
of the class and methods, but a mention of wxruby2, the ‘binary
library’. What’s that?
It’s the compiled file (called wxruby2.so or similar) which provides
most of the core wxRuby API.
Then looking deeper I found the wxruby2 gem’s sources, where again no
explicit mention about ScrolledWindow.new. It looks to me like wxruby2
is a ruby “api” to the underlying c library. There’s mention of Swig,
what’s that?
And then within wxruby2/swig/classes/scrolledwindow.i I find this
inscrutable stuff (see below)… Does that somehow explain what the
RUBY parameters are for ScrolledWindow?
Partly, and also a file included from there,
swig/classes/include/wxScrolledWindow.h, and various other inscrutable
bits of SWIG stuff.
For learning and using the API I would definitely stick to the samples
and docs which should cover all the API, and feel free to ask for help
on the list.
alex