Real Software Forums
http://forums.realsoftware.com/

dynamically add a toolbar
http://forums.realsoftware.com/viewtopic.php?f=1&t=42913
Page 1 of 1

Author:  dpom [ Mon Feb 27, 2012 2:43 am ]
Post subject:  dynamically add a toolbar

Is it possible to dynamically add a toolbar to a window?

Author:  arthofer [ Thu Mar 01, 2012 5:14 am ]
Post subject:  Re: dynamically add a toolbar

Yes and no.
Depends on your definition of "dynamically add".

If you want to add the whole toolbar in code, it wont work unless you add the toolbar to your window and set its visibility to false.

But if you only want to add buttons dynamically, then thats possible and wanted.

Just check the language reference and tutorials.
That will tell you how to add custom buttons and seperators to your toolbar.

Author:  dpom [ Thu Mar 01, 2012 1:21 pm ]
Post subject:  Re: dynamically add a toolbar

Thank you for your reply.

I already studied the examples from Language Reference but i didn't find a solution for my pb. I have an application with several windows and several types of users. Each type of users has his specific toolbar and when he login his toolbar should be created and present in all windows. I succeeded to create the custom toolbar adding to windows an empty toolbar and fill it with ToolbarItems at login. But I don't know how to attach an custom (or maybe a global) Action event to the toolbars.

Author:  NaNdummy [ Thu Mar 08, 2012 1:32 pm ]
Post subject:  Re: dynamically add a toolbar

Search in the reference for AddHandler.

Author:  dpom [ Thu Mar 22, 2012 9:46 am ]
Post subject:  Re: dynamically add a toolbar

I use AddHandler and it works. Thank you.

But now I have an other issue. The actions associated with some toolbar items do the following sequence:
1. open an other window
2. close the current window
Strange the action works first time but if I repeat the operation the application open the second window but crash short time after open it. I think its happen because the toolbar is linked to the closed window but I don't know how to solve this issue. I need a mechanism similar to menu items events where the same sequence works.

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/