Profile Picture

DiagramCommandBar Costumization

Posted By Samuel Matos 11 Years Ago
Author
Message
Samuel Matos
Posted 11 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)

Group: Forum Members
Last Active: 10 Years Ago
Posts: 2, Visits: 1
I've been testing Nevron Diagram for several days.
I am trying to costumize the DiagramCommandbar, for instance, i would like to add option do Main Menu.
Is that possible?
I would like also to add buttons to the current toolboxes.
How can i do that?

Thanks in advance.

Nevron Support
Posted 11 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: 1 days ago @ 1:54 AM
Posts: 3,054, Visits: 4,009
Hello Samuel,

In the diagram example application which comes with the components there is an example which demonstrates the requested functionality.
Open the Diagram Examples for Win Forms and go to "Visual Interface Components" -> "Command Bars example". There you can find a custom command in the bottom most toolbar.

The following knowledge base topic might help too.


Best Regards,
Nevron Support Team



Samuel Matos
Posted 11 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)

Group: Forum Members
Last Active: 10 Years Ago
Posts: 2, Visits: 1
Thank you for your answer.
I had already seen those examples.
I understand how to add a new toolbar with my buttons.
However i don't understand how to add buttons to the current existing toolbars.

When i use the following code:

NDiagramCommander commander = nDiagramCommandBarsManager1.Commander;
commander.Commands.Add(new MyButton());

Nothing happens.

When i use the following code:

NDiagramCommander commander = nDiagramCommandBarsManager1.Commander;
commander.Commands.Insert(1, new MyButton());

If "MyButton" extends the same class as the button on the refered position i will replace that button for mine. However after that replacement all the other buttons on the toolbars just stop working properly. When i click them nothing happens.
if "MyButton" didn't extend the same class noting happens.

So, i can't find a way to actually add a new button to an existing toolbar without replacing other button.

Sorry for my english...

Nevron Support
Posted 11 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: 1 days ago @ 1:54 AM
Posts: 3,054, Visits: 4,009
Hello Samuel,

Following the example in the example application you need to create your own NDiagramButtonCommand and NDiagramCommandBuilder.
The difference is that instead of adding a new toolbar with your command in it just add the command to already existing toolbar:

public override NDockingToolbar[] BuildToolbars()
{
   ArrayList toolbars = new ArrayList(base.BuildToolbars());
   ArrayList beginGroupCommandIds = new ArrayList(this.BeginGroupCommandIds);

   NDockingToolbar toolbar = toolbars[0] as NDockingToolbar; //Getting the first toolbar in toolbars collection.
   int commandId = (int)DiagramCommand.LastCommandId + 1;
   NCommand command = CreateCommand(commandId, beginGroupCommandIds.Contains(commandId));

   if (command != null)
   {
      toolbar.Commands.Add(command);
   }         

   return (NDockingToolbar[])toolbars.ToArray(typeof(NDockingToolbar));
}

In the code above the custom command is added to the first toolbar.

I hope this helps.

Best Regards,
Nevron Support Team





Similar Topics


Reading This Topic