WireLess Studio Widgets Developer's Guide
WSWDG ContentsWStWidget class reference

ModifyLenCtrlMode

This method adds an removes length control modes on a WS_FIELD widget.

Along with SetMaxLength, the length control modes allow to regulate the length of the text processed when the ENTER key is pressed on a WS_FIELD widget.

Ole declaration

VARIANT_BOOL ModifyLenCtrlModeByName(LPCTSTR sObjectName, LONG lRemove, LONG lAdd);

VARIANT_BOOL ModifyLenCtrlModeById(SHORT usObjectId, LONG lRemove, LONG lAdd);

Parameters
sObjectName
The name of the target widget.
usObjectId
The id of the target widget.
lRemove
The modes to be removed from the widget length control modes.
lAdd
The modes to be added to the widget length control modes.
Return Value

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

Remarks

Modes to be added or removed can be combined by using the bitwise OR ( | ) operator.

The available length control modes are:

If the WS_FIELD_LC_FORCE_ENTRY mode is set, the modes WS_FIELD_LC_NO_RETURN_ON_BKSP and WS_FIELD_LC_NO_CR_IF_EMPTY are not necessary.

WS_FIELD_LC_NO_CR_IF_EMPTY is set by default.

The length control modes can be found on the WSFieldConstants enumeration.

Example
C#
using WirelessStudioOleWidgets;
WStWidget oWidget = new WStWidget();
WStFactory oFactory = new WStFactory();
short iFieldId = 33;
oFactory.CreateWidgetById((short)WSTFactoryConstants.WS_FIELD, iFieldId, "", 0,0, 50, 50, "123");
oWidget.ModifyLenCtrlModeById(iFieldId, 0, (short)WSFieldConstants.WS_FIELD_LC_FORCE_ENTRY);
Visual Basic 6 (Full Example: FieldDemoModule.bas.txt)
Public wsWidget As New WStWidget
...
Case "forceEntryCheckBox"
If wsForm.GetLastEventIntValue() = WS_STATE_CHECKED Then
	wsWidget.ModifyLenCtrlModeByName "field", 0, WS_FIELD_LC_FORCE_ENTRY
Else
	wsWidget.ModifyLenCtrlModeByName "field", WS_FIELD_LC_FORCE_ENTRY, 0
End If
...
See also

ModifyInputMode | ModifyDisplayMode | ModifyInputDevices | SetKeyboardMode | SetScannerConfigFile | SetMaxLength | GetLastInputType | GetLastBarcodeType

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