Nevron .NET Vision Documentation
Command Behaviour

Functionality
Generally a NCommand object acts as a button control. It exposes a Click event - the consequence of user input needed for this event to be generated is the same as the standard Click event of all Windows Forms controls - the left mouse button should be pressed and released within the object's bounds. Special case is when a NCommand should display a drop-down menu displaying its children commands.
Arrow Visibility

By default when a command contains child commands, it indicates that with an arrow on its right side. When a command is parented by a NToolbar, the arrow points down, and when the command is parented by a NMenuWindow it points right. Sometimes, however, the arrow should not be visible. Nevron command bars provide extended control over arrow visibility via the ShowArrowStyle property of the common command properties.

 

The following table describes possible arrow visibility:

Value Behaviour
Default

Visibility is determined by the command parent. Currently commands parented by a NMenuBar do not display arrows, on other parents they do.

Always

Arrow is visible on any parent.

Never

Arrow is never displayed.

The following example demonstrates how you can control arrow visibility programmatically:

C#
Copy Code
NCommand command = new NCommand();
//ensure that the arrow will always be displayed
command.Properties.ArrowVisibility = ArrowVisibility.Always;
Visual Basic
Copy Code
Dim command As NCommand = New NCommand()
'ensure that the arrow will always be displayed
command.Properties.ArrowVisibility = ArrowVisibility.Always
Drop-Down Behaviour

There are three types of behaviour when a command containing child commands is clicked.

 

The following table describes these types:

 

Value Behaviour
Default

The command will let the framework decide whether a menu should be dropped or a single click will be performed. The framework determines this using the following approach:

  • If the arrow is visible a menu is displayed only if the user has clicked within the arrow rect. Otherwise a single click is performed.
  • If the arrow is hidden a menu is always displayed.
AlwaysDropDown

A menu is always displayed regardless of the arrow visibility and children commands count.

NeverDropDown

The command will never display a menu regardless of its arrow visibility and children commands count.


The following example demonstrates how to create a command which will always display a drop-down menu when clicked:

C#
Copy Code
NCommand command = new NCommand();
command.Properties.DropDownBehaviour = DropDownBehaviour.AlwaysDropDown;
Visual Basic
Copy Code
Dim command As NCommand = New NCommand()
command.Properties.DropDownBehaviour = DropDownBehaviour.AlwaysDropDown
Notifications

NCommand object fires the following notifications:

 

Name Usage
 Click

Fired when the user has clicked a command:

That is the following consequence of user input:

 

  1. Left mouse button is pressed within command's bounds.
  2. Left mouse button is released within command's bounds.
 ClosePopup

Fired when a NCommand has closed its child menu.

 Deselect

Fired when a NCommand is deselected (unhovered) - that is when the mouse pointer leaves command's bounds.

 Measure Fired whenever a NCommand object needs to be measured. Valid only when OwnMeasure property is true.
 Paint Fired whenever a NCommand object needs to be painted. Valid only when OwnPaint property is true.
 Popup Fired when a NCommand is about to display its child menu.
 QueryUIState Fired prior to command's parent SmartRefresh method. Useful for dynamic updates of command's state.
 Select Fired whenever the mouse pointer enters command's bounds.

Remarks
A NCommand will automatically bubble unhandled notifications to its parent and NCommandBarsManager (if any).
See Also

 

 


©2017. Nevron Software LLC.

Send Feedback