Return to the menu   Select another DES Module

Demonstrates the Help Button and Content Menu

The TimeOfDayTextBox and DurationTextBox have the following commands:

  • Now - (Not on DurationTextBox) Sets the current time of day.
  • Next Hour - Advances one hour
  • Previous Hour - Goes back one hour
  • Next Minute - Advances one minute
  • Previous Minute - Goes back on minute
  • Next Second - Advances one second
  • Previous Second - Goes back one second
  • TimePicker - Pops up the TimePicker

The user can access these commands in three ways:

  • Keyboard shortcut - Type a special keystroke to invoke the command.
  • Help button - Displays a toggle button to display a menu of commands. Use the HelpCommandAndButton property to activate the button and set its appearance.
  • Context menu - Right click in the textbox to display a menu of commands. It is the same menu as on the Help button. It is enabled by default. To disable it, set ContextMenu.Activate to false.

The following properties host the features of each command: NowCommand, NextHourCommand, PreviousHourCommand, NextMinuteCommand, PreviousMinuteCommand, NextSecondCommand, PreviousSecondCommand, and PopupTimePickerCommand

These Command properties can be customized in several ways:

  • To rename a command, assign the name in the CommandName property.
  • To change the keyboard shortcut, assign the keystroke combination in the MenuKeys property.
    Only one keystroke must be hit to execute a command. However, you can define multiple keystrokes, each to run the same command. This allows for you to assign several familiar keystrokes for the command. For example, the Today command can be both "T" and "D". To enter multiple keystrokes, separate each with a space. For example, TodayCommandKeys = “T D”.
    The TimeOfDayTextBox allows commands to be assigned to most keys except the digits and the date separator. You can also assign these terms: ENTER, ESC, SPACE, PAGEUP, PAGEDOWN, HOME, END, F1..F12, DELETE, LEFT, RIGHT, UP, and DOWN. If you set this property to an empty string, no keystroke will support that command. However, the context menu will still offer this command.
    These commands also support the Control key modifier. Put “CTRL+” before the character. For example, “CTRL+T”.
  • To remove a command, set its ShowCommandInMenu property to false. The keyboard short cut is still active until you set MenuKeys to "".

These examples use the TimeOfDayTextBox but also work with DurationTextBox.


Controls

Adding the Help button

The ContextMenu is available too as its active by default.

Help - show commands


Removing the ContextMenu

Right click in the textbox. The browser's standard context menu appears.

Help - show commands


Changing the command name and its keystroke

This example renames the TimePicker command to "Display available times" and allows both "T" and Control D to display the calendar.

...
Help - show commands


Removing commands

This example removes the Now command.

Help - show commands



Source Code (C#)

<h2>Adding the Help button</h2>
The ContextMenu is available too as its active by default.<br/><br/>
<des:TimeOfDayTextBox ID="TimeOfDayTextBox1" runat="server" AutoHint="false">
   <HelpCommandAndButton ShowButton="true" />
</des:TimeOfDayTextBox>
<br/><br/>
<h2>Removing the ContextMenu</h2>
Right click in the textbox. The browser's standard context menu appears.<br/><br/>
<des:TimeOfDayTextBox ID="TimeOfDayTextBox2" runat="server" AutoHint="false">
   <HelpCommandAndButton ShowButton="true" />
   <ContextMenu Activate="false" />
</des:TimeOfDayTextBox>
<br/><br/>

<h2>Changing the command name and its keystroke</h2>
This example renames the <a href="TimePicker.aspx"  class="ControlClass">TimePicker</a> command to "Display available times"
and allows both "T" and Control D to display the calendar.<br/><br/>
<des:TimeOfDayTextBox ID="TimeOfDayTextBox3" runat="server" AutoHint="false" >
   <HelpCommandAndButton ShowButton="true" />
   <PopupTimePicker Activate="true" AutoFillStartTime="10:00:00" AutoFillEndTime="18:00:00" />
   <PopupTimePickerCommand CommandName="Display available times" MenuKeys="T CTRL+D" />
   <ContextMenu SharedGroup="TimeOfDayTextBox3" />
</des:TimeOfDayTextBox>
<br/><br/>
<h2>Removing commands</h2>
This example removes the Now command.<br/><br/>
<des:TimeOfDayTextBox ID="TimeOfDayTextBox4" runat="server" AutoHint="false" >
   <HelpCommandAndButton ShowButton="true" />
   <NowCommand ShowCommandInMenu="false" MenuKeys="" />
   <ContextMenu SharedGroup="TimeOfDayTextBox4" />
</des:TimeOfDayTextBox>
<br/><br/>

Return to the menu   Select another DES Module