how to create a toolbar

Hello,

I’ve been searching in the forum and the wiki for a while now, but can’t seem to locate any info on how to create a toolbar in Servoy. I did find the documentation on the toolbar methods of the “window” plugin, but I was looking for some higher-level explanation/example of how to create a basic toolbar. Is it done entirely in javascript?

I’m new to Servoy, so it’s altogether possible I could have overlooked something. Can someone please point me in the right direction?

Thanks,
Rick

Hi,

This is a simple example for you.
I hope it illustrate the principle.

for more information : http://wiki.servoy.com/display/public/DOCS/ToolBar

I hope this help :wink:

toolbarExample.servoy (3.27 KB)

Hi madimane,

Thanks for the little example!

var firstToolbar = plugins.window.addToolBar("toolbar1");

is already giving you back a reference to the toolbar you just added, so the second line:

var toolbar = plugins.window.getToolBar("toolbar1");

is not necessary.

You can use your first variable directly like this:

firstToolbar.addButton("Hello", func1);

Ok, so I guess the “addToolbar” actually creates the toolbar and adds it to the window in one step. That’s the part that was confusing me.

Thanks for the example (and sorry it’s taken so long to post a response)!