[wxruby-users] Problems with ToolBar Sintaxis
Alex Fenton
alex at pressure.to
Sat Sep 27 07:09:19 EDT 2008
Hi
Omar Hernandez wrote:
> I'm having problems with the code for a toolbar, i want to add an item,
> but a don't know how. this is my code for now:
>
>
> @toolBarPrincipal=ToolBar.new(@panel)
> @toolBarPrincipal.add_tool(-1, '&Bonzai', Bitmap.new("/home/.......
> icon.ico"))
>
> I've already red the http://wxruby.rubyforge.org/doc/toolbar.html page
> (mi code is basically what comes there.
>
> I want to put it into a panel, named panel. At this point, a litle dot
> is drawn on the top-left corner (under a menu bar) but no icon.
>
Maybe you need to call ToolBar#realize after you've added all your items?
Or if you are placing the ToolBar within a panel, maybe you need to use
a Sizer to allocate space for the ToolBar?
If the ToolBar is intended as the main ToolBar for a frame, it can be
better to call Frame#create_tool_bar or Frame#set_tool_bar. This will
deal with the sizing, and also ensure that the ToolBar has a native
style - on OS X, a native toolbar can only be on the top.
> I'd appreciate if you help me. A correction, some code examples or some
> links would be perfect.
You might take a look at the wxToolBar.rb sample in samples/bigdemo/;
you should find the sampes installed in your gems directory.
If you want further help, please post a short, complete, runnable sample
with your toolbar code.
hth
alex
More information about the wxruby-users
mailing list