Profile Picture

Problem adding multiple buttons to custom toolbar

Posted By Eric Sweet 14 Years Ago
Author
Message
Eric Sweet
Posted 14 Years Ago
View Quick Profile
Junior Member

Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)

Group: Forum Members
Last Active: 14 Years Ago
Posts: 14, Visits: 1
That did the trick. I changed the reset event to a for loop that increments the counter for each button added and it works. Thanks for the advice.

Eric

Nevron Support
Posted 14 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009

Hi Eric,

The example code above applies for NCommandBarsManager control, not for NDiagramCommandBarsManager.

In the example application (I guess you mean CommandBars example) to add another NCustomDiagramButtonCommand you need to set its ID property with value equal to the Id of the previous command + 1. Also in the example there is a filed customCommandIds of type ArrayList. In Reset method you should add a int value equal to the new command Id.

This way you should be able to add another button command to the diagram command bars manager.

Please, let us know if you still have problem with this.



Best Regards,
Nevron Support Team



Eric Sweet
Posted 14 Years Ago
View Quick Profile
Junior Member

Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)

Group: Forum Members
Last Active: 14 Years Ago
Posts: 14, Visits: 1
Thanks, I'll try it shortly. Just to make sure though, this will work with the built in command bars manager used by the diagramming control? Because the code looks nothing like the code from the sample application for adding a button.

Thanks again,
Eric

Nevron Support
Posted 14 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009

Hi Eric,

Here is the requested code sample that adds two custom menu items with hosted button:

NButton btn1 = new NButton();
btn1.Text =
"Button 1";

NControlHostCommand controlHost1 = new NControlHostCommand();
controlHost1.SetControl(btn1);

nDockingToolbar1.Commands.Add(controlHost1);

NButton btn2 = new NButton();
btn2.Text = "Button 2";

NControlHostCommand controlHost2 = new NControlHostCommand();
controlHost2.SetControl(btn2);

nDockingToolbar1.Commands.Add(controlHost2);



Best Regards,
Nevron Support Team



Eric Sweet
Posted 14 Years Ago
View Quick Profile
Junior Member

Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)

Group: Forum Members
Last Active: 14 Years Ago
Posts: 14, Visits: 1
Hi,

I've used the code from the sample app to add custom menu items, overload the functionality of existing buttons and add a single toolbar and button without any problems, but I am having trouble with adding more than one button to a custom toolbar. I always end up with just one button, and no errors. Can you provide any assistance with the code from the sample app for adding multiple buttons?

Thanks
Eric



Similar Topics


Reading This Topic