WireLess Studio Widgets Developer's Guide
WSWDG ContentsWStForm class reference

GetNextWidget

Call this method to retrieve a widget that has the "tab stop" property and follows a specific widget.

Ole declaration

SHORT GetNextWidgetById(SHORT usFormId, SHORT usObjectId);

BSTR GetNextWidgetByName(LPCTSTR sFormName, LPCTSTR sObjectName);

Parameters
sFormName
The form's name.
usFormId
The form's id.
usObjectId
Specifies the id of the widget to be used as start point of search.
sObjectName
Specifies the name of the widget to be used as start point of search.
Return Value

On success, GetNextWidget returns the name or the id of the next widget with tab stop property enabled (depending on which version of the method is used). On error, GetNextWidget returns an empty string or zero. To get extended information, call WStError::GetLastErrorCode.

Remarks

The default order is given by the way in which the widgets are attached to the form.

Only the widgets that support the EnableTabStop method can be enumerated using this method.

Example
C#
using WirelessStudioOleWidgets;
WStFactory oFactory = new WStFactory();
WStForm oForm = new WStForm ();
short formId = 10;
oFactory.CreateFormById(formId);
oFactory.CreateWidgetById((short)WSTFactoryConstants.WS_BUTTON, 10 , "", 15, 15, 30, 30, "Button Test 1");
oFactory.CreateWidgetById((short)WSTFactoryConstants.WS_BUTTON, 11 , "", 15, 45, 30, 30, "Button Test 2");
oFactory.CreateWidgetById((short)WSTFactoryConstants.WS_BUTTON, 12 , "", 15, 75, 30, 30, "Button Test 3");

oForm.AddObjectBydId(formId, 10);
oForm.AddObjectBydId(formId, 11);
oForm.AddObjectBydId(formId, 12);

oForm.ShowById(formId, true, true);
short nextObjectId = oForm.GetNextWidgetById(formId, 10);

if(nextObjectId != 0)
{
	oForm.SetFocusById(nextObjectId);
}

Visual Basic 6 (Full Example: PopupMsgDemoModule.bas.txt)
Public wsForm As New WStForm
...
If wsForm.GetLastEventType() = WS_EVENT_TEXT_INPUT Then
	sNextWidget = wsForm.GetNextWidgetByName("popupMsgForm", sObjectName)

	If sNextWidget <> "" Then
		wsForm.SetFocusByName "popupMsgForm", sNextWidget
	End If
End If
...	
See also

SetFocus

WStWiget class reference | WStForm class reference | WStFactory class reference | WStError class reference