Skip to main content

Responding to Navigator Button Clicks

  • 5 minutes to read

The TcxNavigator control enables you to add navigation capabilities to any object. For instance, it may be used to navigate through a dataset created at runtime or perform navigation through items of some control. This is possible because the object affected by the navigator control is specified by the Control property which is of the IcxNavigator type.

If you need to bind the navigator to an existing object that doesn’t support the interface, you must create a descendant and implement interface methods.

This topic is concerned with the IcxNavigator.DoAction method that implements the button functionality. The method performs actions mapped to each button via the button index, as listed in the table:

Action

Button Image

Button Index

Description

First

First Item Button

NBDI_FIRST

Must be implemented to respond to clicking the First button. This button is intended to select the first item of the underlying data. The button’s settings can be accessed via the navigator’s Buttons.First property.

PriorPage

Previously Selected Item Button

NBDI_PRIORPAGE

Must be implemented to respond to clicking the PriorPage button. This button is intended to move the selection by the predefined number of items backwards. The button’s settings can be accessed via the navigator’s Buttons.PriorPage property.

Prior

Previous Item Button

NBDI_PRIOR

Must be implemented to respond to clicking the Prior button. This button is intended to select the previous item. The button’s settings can be accessed via the navigator’s Buttons.Prior property.

Next

Next Item Button

NBDI_NEXT

Must be implemented to respond to clicking the Next button. This button is intended to select the next item. The button’s settings can be accessed via the navigator’s Buttons.Next property.

NextPage

Next Page Button

NBDI_NEXTPAGE

Must be implemented to respond to clicking the NextPage button. This button intended to move selection by a predefined number of items forward. The button’s settings can be accessed via the navigator’s Buttons.NextPage property.

Last

Last Item Button

NBDI_LAST

Must be implemented to respond to clicking the Last button. This button is intended to select the last item of the underlying data. The button’s settings can be accessed via the navigator’s Buttons.Last property.

Insert

Insert Item Button

NBDI_INSERT

Must be implemented to respond to clicking the Insert button. This button is intended to insert a new item to the current position. The button’s settings can be accessed via the navigator’s Buttons.Insert property.

Append

Append Item Button

NBDI_APPEND

Must be implemented to respond to clicking the Append button. This button is intended to append a new item to the underlying data. The button’s settings can be accessed via the navigator’s Buttons.Append property.

Delete

Delete Item Button

NBDI_DELETE

Must be implemented to respond to clicking the Delete button. This button is intended to delete the currently selected item of the underlying data. The button’s settings can be accessed via the navigator’s Buttons.Delete property.

Edit

Edit Item Button

NBDI_EDIT

Must be implemented to respond to clicking the Edit button. This button is intended to switch the underlying object to the edit mode. The button’s settings can be accessed via the navigator’s Buttons.Edit property.

Post

Post Button

NBDI_POST

Must be implemented to respond to clicking the Post button. This button is intended to apply changes made to the underlying data. The button’s settings can be accessed via the navigator’s Buttons.Post property.

Cancel

Cancel Button

NBDI_CANCEL

Must be implemented to respond to clicking the Cancel button. This button is intended to cancel changes made to the underlying data if they haven’t been posted already. The button’s settings can be accessed via the navigator’s Buttons.Cancel property.

Refresh

Refresh Button

NBDI_REFRESH

Must be implemented to respond to clicking the Refresh button. This button is intended to update the underlying data (or to update its visual representation). The button’s settings can be accessed via the navigator’s Buttons.Refresh property.

SaveBookmark

Save Bookmark Button

NBDI_SAVEBOOKMARK

Must be implemented to respond to clicking the SaveBookmark button. This button is intended to store a bookmark corresponding to the current record. The button’s settings can be accessed via the navigator’s Buttons.SaveBookmark property.

GotoBookmark

Navigate to Bookmark Button

NBDI_GOTOBOOKMARK

Must be implemented to respond to clicking the GotoBookmark button. This button is intended to locate the item corresponding to the saved bookmark. The button’s settings can be accessed via the navigator’s Buttons.GotoBookmark property.

Filter

Filter Button

NBDI_FILTER

Must be implemented to respond to clicking the Filter button. This button is intended to apply filtering to the underlying data. The button’s settings can be accessed via the navigator’s Buttons.Filter property.

Any custom button

No default image.

You can associate an image with a button via the button’s ImageIndex property.

The default index is assigned automatically, starting from NavigatorButtonCount.

Custom logic.

As you can see, each button provided by the navigator control has its specific meaning. Additionally, each button has a descriptive image assigned by default. This will suit your needs most commonly.

Actually, when using the TcxNavigator control, each button can perform any actions you like. This means that the control should not necessarily be used to only navigate through and edit data. For instance, you may provide a button that copies the content of the currently selected data item into the clipboard. Another example can be using navigator buttons to assign different styles to data items visually represented in the control bound to the navigator.

It is insufficient to provide the custom behavior for a button by implementing the corresponding interface method in a specific manner. You need to provide another appearance for the button in this case. This must be performed in the implementation of the TcxNavigatorControlNotifier.AddNavigator method. The method is automatically called when the object that implements the interface becomes bound to the navigator (see the navigator’s Control property). To access settings of the desired button, use properties listed in the table above.

You can also use the TcxNavigatorControlNotifier.AddNavigator method to hide the buttons of the navigator control that are not needed when operating on the object of a specific type. Note that you must use the TcxNavigatorControlNotifier.RemoveNavigator method if you need to restore the initial navigator’s settings when disconnecting the navigator from the object.

See Also