Adding ToolBarButtons via UIExtensionSites[x].Add(

Topics: CAB & Smart Client Software Factory
Jan 2, 2006 at 1:47 PM
originally posted by: dannytuppeny

Is it not possible to add buttons to the toolbars in the same way as adding to the menus? I thought they'd just work in the same way, but if I try something like this:

ToolStripMenuItem myMenuItem = new ToolStripMenuItem("My Item");
ToolBarButton myButton = new ToolBarButtonMy Button");

I get an ModuleLoadExceptoin which reads "UI element must be a ToolStripItem"

Any ideas?
Jan 2, 2006 at 4:55 PM
originally posted by: SUBATBLOOMINGTON

Presently CAB Provides out of the box ToolstripCollectionUIAdapter--->Menu strips and toolstrips , i think for toolbar you need to build a custom uiadapter.
Jan 3, 2006 at 2:44 AM
originally posted by: dannytuppeny

So I can add a whole toolstrip? That's not so bad :-)

I'll have a pay later!
Jan 3, 2006 at 2:48 PM
originally posted by: tpolansk

no need to build a custom UI adapter... at least if you're using .NET 2.0. try the ToolStripButton class instead with the appropriate container (ToolStrip).
Jan 3, 2006 at 7:11 PM
originally posted by: PProvost

ToolBarButton is the WinForms 1.x class. In WinForms 2.0, all tool strip items derive from the ToolStripItem base class.

I believe you are looking for ToolStripButton.

Should work like a charm.
Jan 4, 2006 at 2:24 AM
originally posted by: dannytuppeny

Cool :)

I did try casting ToolBarButton as a ToolStripItem (which failed). I'll try that and see how I get on :)
Jan 6, 2006 at 1:04 PM
originally posted by: JayUrbanowicz

Peter, how about some examples rather then "I believe..."? Also in the help it says something like "You can build a docking workspace, like in Visual Studio" but it never doesn’t say how to do it. There are various posts looking for this guidance. The docs for CAB has always shown the Dell help desk example but P&P has never made a similar example available. Will one of the BAT examples show these?
Jan 6, 2006 at 5:50 PM
originally posted by: dcazzulino

The problem in providing such a docking example is that WinForms 2.0 comes with no built-in full featured docking control that would do what VS does. Hence, in order to provide the example, p&p would actually have to develop the docking panels and managers first, which is completely out of the scope of CAB IMO, as multiple third party control vendors offer such a thing (and also some open source or free controls). That's basically why there isn't such an example, I believe.
Jan 7, 2006 at 1:36 PM
originally posted by: JayUrbanowicz

What about a tool bar example? ~Every microsoft app has them but none of the cab examples do. (It seems a little strange that there is an assumed menu for a form.)