RAD Studio |  |

Hiding Unused Items and Categories in Action Bands
See Also
Collapse All

One benefit of using ActionBands is that unused items and categories can be hidden from the user. Over time, the action bands become customized for the application users, showing only the items that they use and hiding the rest from view. Hidden items can become visible again when the user presses a drop-down button. Also, the user can restore the visibility of all action band items by resetting the usage statistics from the customization dialog. Item hiding is the default behavior of action bands, but that behavior can be changed to prevent hiding of individual items, all the items in a particular collection (like the File menu), or all of the items in a given action band.

The action manager keeps track of the number of times an action has been called by the user, which is stored in the associated TActionClientItem's UsageCount field. The action manager also records the number of times the application has been run, which we shall call the session number, as well as the session number of the last time an action was used. The value of UsageCount is used to look up the maximum number of sessions the item can go unused before it becomes hidden, which is then compared with the difference between the current session number and the session number of the last use of the item. If that difference is greater than the number determined in PrioritySchedule, the item is hidden. The default values of PrioritySchedule are shown in the table below:

Default values of the action manager's PrioritySchedule property

Number of sessions in which an action band item was used | Number of sessions an item will remain unhidden after its last use
0, 1 | 3
2 | 6
3 | 9
4, 5 | 12
6-8 | 17
9-13 | 23
14-24 | 29
25 or more | 31

It is possible to disable item hiding at design time. To prevent a specific action (and all the collections containing it) from becoming hidden, find its TActionClientItem object and set its UsageCount to -1. To prevent hiding for an entire collection of items, such as the File menu or even the main menu bar, find the TActionClients object associated with the collection and set its HideUnused property to False.

See Also

TActionManager

TActionBars

TActionClients

TActionClientItem

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!