John G. wrote:
Hi, trying to display a bitmap button, don’t have a validator at the
moment so using wxruby’s defaultvalidator method,
b = Wx::BitmapButton.new(self, 10, 'assets/images_only_btn.jpg',
This should be Wx::Bitmap.new(‘assets/images_only_btn.jpg’)
Wx::Point.new(170,210), Wx::Size.new(120,80), 0, Wx::DefaultValidator,
‘Import Data’)
should work but just returns me with…
“uninitialized constant Wxruby2::DefaultValidator (NameError)”
It’s not a method, it’s a constant, and its name is
Wx::DEFAULT_VALIDATOR. I’ve corrected the wrong naming of this in the
documentation, sorry for the trouble.
By the way, this isn’t going to do what I’m guessing you want - display
a button with an image and some text. The ‘name’ parameter only provides
an internal reference name to any Window; I’ve never seen it used.
There’s no default widget to draw a bitmap + text button in wxRuby,
because there isn’t one in wxWidgets 2.8. The reason given for this is
that that button style isn’t part of the desktop standard on either
Windows or OS X. It happens in Windows because there is little interface
consistency, but it would look quite wrong on OS X.
If you give an ordinary Wx::Button a ‘stock id’ eg Wx::ID_OPEN, it will
be given the appropriate theme image on Linux/GTK.
I think that the wx developers have given in to people frequently asking
for this and intend to add a bitmap + text button to wx 3.0
alex