[wxruby-users] wxRuby / wxWigets with C++
Łukasz Łapiński
l.lap at wp.pl
Fri Apr 18 12:45:46 EDT 2008
Hi,
I am experimenting with integration of C++ and Ruby. What exactly I would
like to do is to provide an option to use Ruby and wxRuby for creation of
GUI and doing algorithms in C++ and then displaying results in the openGL
Canvas.
I can easily use openGl / Glut in "render" function in C++ say class
VisualiseGraph, build using SWIG an extention to Ruby and then use this
function (that does not take any parameters and returns void) to display
on the wxGLCanvas
(
@canvas.evt_paint { @canvas.paint { render } }
).
But I would also like to transfer the data from the form built using Ruby
into some classes in C++. Like parameters: numbers and string. But I am
wondering if it is possible to create controls in Ruby and then just
assign then into C++ fields (the controls not values). For example
class FormInCpp
{
wxTextField * someText;
void setSomeText(wxTextField * param){
someText = param;
}
}
then use SWIG to build extention in module say Llap
and then
txt = Wx::TextCtrl.new(self, -1, "val")
form = Llap::FormInCpp.new
form.setSomeText(txt)
I thought these are in fact the same controls, they were written in C++,
but I guess txt is not of type [wxTextField *], but rather
#<SWIG::TYPE_p_wxTextCtrl:0xb7c49944>
so how to get the pointer to wxTextField so I can manipulate the control
from cpp class like this
someText->GetValue()
and then do smthing with this value.
--
Kind regards,
Łukasz Łapiński
More information about the wxruby-users
mailing list