CreatePushButton Method

This member of Class WaveLinkFactory is supported on: Palm, CE

The CreatePushButton Method creates a set of buttons that store an on/off state. When the user selects a button, the selected button stores the "on" state, and all other buttons store the "off" state. Only one button can store the "on" state at any time.

Syntax

public WaveLinkWidget CreatePushButton(int XCoord, int YCoord, int Width, int Height, String menuName, int initialOption, WaveLinkWidgetCollection targetCollection)
throws WaveLinkError

Parameters

XCoord

The starting left coordinate of the widget

YCoord

The starting top coordinate of the widget

Width

The horizontal extent of the widget

Height

The vertical extent of the widget (set Remarks)

menuName

The name of the WaveLinkMenu configuration associated with the widget

initialOption

The initial menu-index value of the widget (For example, passing a 1 indicates the first menu entry in the WaveLinkMenu configuration)

targetCollection

The name of the collection that will contain the widget

Returns

A pointer to the push button widget

Throws

WaveLinkError

Remarks

The push button widget populates its menu options with a stored WaveLinkMenu configuration. The menu must be stored on the device before the push button can access it. The widget returns the menu index of the user-selected option.

You can set additional display properties for the push button widget using the DisplayFlags Property.

The CreatePushButton Method automatically stores the menu name associated with the current widget in the SpecialString Property of the Class WaveLinkWidget.

The DefaultCoordinateType Property determines how the application interprets the values entered for the position, width, and height of the widget.

For the Width and Height parameters, pass a value of 0 to set the width or height automatically. Set the size of the widget to AUTOSIZE by setting both the width and height to zero (0).

We recommend that you use the AUTOSIZE setting for the height and width of the push button. Changing this value from its default does not change the size of the widget, only the extent of the clickable area surrounding it.

Example

WaveLinkFactory factoryIface = new WaveLinkFactory();

WaveLinkWidgetCollection colIface = new WaveLinkWidgetCollection();

WaveLinkIO ioIface = new WaveLinkIO();

WaveLinkMenu mnuIface = new WaveLinkMenu();

WaveLinkWidget myWidget;

try {

mnuIface.ResetMenu();

mnuIface.MenuWidth(18);

mnuIface.AddOption("1");

mnuIface.AddOption("2");

mnuIface.AddOption("3");

mnuIface.StoreMenu("DegofDif");

.

.

.

// In this example, show some context for the widget.

ioIface.RFPrint(0, 0, "Degree of ", WaveLinkIO.WLCLEAR);

ioIface.RFPrint(0, 0, "Difficulty:", WaveLinkIO.WLNORMAL);

myWidget = factoryIface.CreatePushButton(3, 5, 0, 0, "DegofDif", 1, colIface);

// Format the push button

myWidget.setDisplayFlags(WaveLinkWidget.PBFIXED);

colIface.StoreWidgets();

}

catch (WaveLinkError wlErr) {

//Do error handling

}

 


Was this article useful?    

The topic was:

Inaccurate

Incomplete

Not what I expected

Other

© 2016 Wavelink Corporation. All Rights Reserved.