WireLess Studio Widgets Developer's Guide
WSWDG ContentsWStForm class reference

SetFocus

This method gives the keyboard focus to a widget attached on a specific form.

Ole declaration

VARIANT_BOOL SetFocusByName(LPCTSTR sFormName, LPCTSTR sObjectName);

VARIANT_BOOL SetFocusById(SHORT usFormId, SHORT usObjectId);

Parameters
sFormName
The form's name.
usFormId
The form's id.
sObjectName
The name of the widget that will receive the keyboard focus.
usObjectId
The id of the widget that will receive the keyboard focus.
Return Value

On success, SetFocus returns TRUE, FALSE otherwise. To get extended information, call WStError::GetLastErrorCode.

Remarks
Example
C#
using WirelessStudioOleWidgets;
WStFactory oFactory = new WStFactory();
WStForm oForm = new WStForm ();
short formId = 10;
short fieldId = 15;

oFactory.CreateFormById(formId);
oFactory.CreateWidgetById((short)WSTFactoryConstants.WS_FIELD, fieldId, "myField", 15, 15, 30, 30, "Field");
oForm.AddObjectBydId(formId, fieldId);
oForm.SetFocusById(formId, fieldId);
oForm.ShowById(formId, true, true);
Visual Basic 6 (Full Example: FieldDemoModule.bas.txt)
Public wsForm As New WStForm
...
wsForm.SetFocusByName "myForm", "field"
bResult = wsForm.ShowByName("myForm", True, True)
...	
See also

SetFocus

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