WireLess Studio Widgets Developer's Guide
WSWDG ContentsWStWidget class reference

SetGroupId

Sets the group id for a WS_RADIO_BUTTON widget. Radio buttons behavior depends on other radio buttons attached to the same form. To group radio buttons for a specific purpose each radio button must have the same group id.

Ole declaration

VARIANT_BOOL SetGroupIdByName(LPCTSTR sObjectName, BYTE bGroupId);

VARIANT_BOOL SetGroupIdById(SHORT usObjectId, BYTE bGroupId);

Parameters
sObjectName
The name of the target widget.
usObjectId
The id of the target widget.
bGroupId
The new group id for a radio button, this parameter must be nonzero.
Return Value

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

Remarks

By default a radio button has no group assigned and it's behavior it's undefined: If two or more radio buttons are created in a sequentially way (and their group ids are not set), they may act as if they were in the same group (change of focus, change of state).

The group id can be set only once.

Example
C#
using WirelessStudioOleWidgets;
WStWidget oWidget = new WStWidget();
WStFactory oFactory = new WStFactory();
short iMenuId = 15;
oFactory .CreateWidgetById((short)WSTFactoryConstants.WS_MENU, iMenuId,"", 0,0, 50, 50, "");
oWidget.ChangeMenuTypeById(iMenuId, (short)WSTWidgetConstants.WS_COMBO_BOX_MENU_TYPE);
oWidget.AddOption(iMenuId, 0, "Show Menu");
oWidget.AddOption(iMenuId, 0, "Save File");
oWidget.AddOption(iMenuId, 0, "Close Application");
Visual Basic 6 (Full Example: RadioButtonDemoModule.bas.txt)
Public wsWidget As New WStWidget
Public wsFactory As New WStFactory		
...
'Two radio button groups are defined
wsWidget.SetGroupIdByName "myRadioButton", 1
wsWidget.SetGroupIdByName "myRadioButton2", 1
wsWidget.SetGroupIdByName "myRadioButton3", 1
   
InitRBGroup1 ("myRadioButton")
InitRBGroup1 ("myRadioButton2")
InitRBGroup1 ("myRadioButton3")
   
wsWidget.SetGroupIdByName "myRadioButton4", 2
wsWidget.SetGroupIdByName "myRadioButton5", 2
wsWidget.SetGroupIdByName "myRadioButton6", 2
...
See also

SetState | ModifyStyle | GetState

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