Dynamic toolbars

Bars for Windows Forms Forum

Posted 18 years ago by Thierry Bouchard
Avatar
Hi,

my application supports the creation of dynamic toolbars via a plugin system. The problem is that even if I activate a dynamic toolbar, it doesn't display.
I noticed that when calling the BarManager EndInit method in the InilializeComponent method of my form, some calculations are made to set the BodyBounds property of the dockable toolbars, which is essential for them to be displayed. In my case, the initialization of dynamic toolbars is made after the InitializeComponent method, so the BodyBounds is never calculated.

So I tried various things, like calling the BeginInit and EndInit method before adding a toolbar to the BarManager, which seems to work. I also tried just setting the Active property of a dockable toolbar to false and then to true, which forces a recalculation of the BodyBounds property. But all these workarounds semms a little ugly and furthermore, the recalculation decides to place the toolbar at a different position than it was intended to be placed. For example I wanted to place my toolbar at row 0 column 3, which is completely valid, but the recalculation decides that my toolbar will appear on row 1.

So my question is, is there a normal and clean way to have a toolbar created dynamically to be displayed properly or do I have to make one of those workaround? If so, how can I have my dynamic toolbar to remain at the position it was supposed to be placed?

Thx

Comments (2)

Posted 18 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Thierry,

It should be very straightforward unless I'm missing something that you're describing. Paste this code at the end of our BarForm constructor:
DockableToolBar testToolBar = new DockableToolBar("Test");
barManager.DockableToolBars.Add(testToolBar);
testToolBar.CommandLinks.Add(barManager.Commands["File.New"].CreateCommandLink());
testToolBar.DockTo(DockableToolBarPosition.Top, 0, 3, false);
Please reply whether this accomplishes what you want.


Actipro Software Support

Posted 18 years ago by Thierry Bouchard
Avatar
Thats pretty much what Im doing, beside that Im using the "DockedColumn" and "DockedRow" properties of the toolbar to determine where I want to place it.

The DockTo does what I want, i.e. it recalculate the bounds of the toolbar and even allow me to put it on the row I want, so thats what I was looking for.

Thx!
The latest build of this product (v24.1.0) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.