Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Direction Dialog

Microsoft Robotics

Glossary Item Box

Microsoft Robotics Developer StudioSend feedback on this topic

Direction Dialog

Direction Dialog Icon

The Direction Dialog service provides a simple dialog window with a set of five predefined directional buttons (and a Stop button). However, the Direction Dialog by itself does not control anything. It only generates notification messages whenever the buttons on the dialog are pressed, but you can create a diagram to use the button press notifications for whatever purpose you require.

When you run your diagram the Direction Dialog service automatically starts and displays its window as shown in the figure below. It does not have an operation that causes it to be displayed.

Direction Dialog

Direction Dialog with buttons for directional control

The Direction Dialog is intended as a simple example of using Windows forms as part of your VPL application. You also find the Desktop Joystick, Flexible Dialog, and Simple Dialog services useful to support other forms of input.

The source to this service is provided. If you wish you can modify this dialog to change the buttons or add new ones.

Operations

The following operations are supported for this service.

OperationDescription
GetGets the current state of the set of buttons in the dialog.
DialogStateChangeChanges the state of the buttons in the dialog.
ButtonPressIndicates that a button in the dialog has been pressed.
ButtonReleaseIndicates that a button in the dialog has been released.

Get is only available as a request. The other operations are available as both requests and notifications, though you will typically access them only as notifications.

The Get request returns a List of Buttons. Each element of the List, accessed using Buttons[index], where index runs from 0 to 4 (because there are 5 buttons), has Direction, Name and Pressed properties. The value of Pressed is true if the button is pressed, and false if not. A DialogStateChange notification is not generated when a button is pressed or released.

The ButtonPress and ButtonRelease notifications return Direction and Name.

The Direction will return one of the following values:

  • ButtonDirection.Backwards
  • ButtonDirection.Forwards
  • ButtonDirection.Left
  • ButtonDirection.Right
  • ButtonDirection.Stop

Name returns a string that contains the text equivalent ine of the directions listed above, e.g. "Backwards", "Forwards", "Stop", etc.

When you receive notifications from the Direction Dialog, there are two ways you can handle them. First, you can use only the ButtonPress notifications and ignore ButtonRelease. This has the effect of executing a task or action when you press a button. The second approach is to initiate the appropriate task or action when a ButtonPress notification is received, and terminate that task/action when the button is released (using ButtonRelease). This has the effect that the associated task/action will only continue as long as you hold down a button.

 

 

© 2012 Microsoft Corporation. All Rights Reserved.

Show:
© 2015 Microsoft