WireLess Studio Widgets Developer's Guide
WSWDG ContentsWStWidget class reference

EnableSubmitMode

Enables the "Submit mode" on a widget.

When the "Submit mode" is enabled and the widget triggers an event, all the WS_FIELD widgets attached to the same form are forced to trigger their input events, sending the text that are currently displaying. This occurs only if the field's text has changed and it hasn't been sent before to the server. The widget's event is processed after the input events are sent.

Ole declaration

VARIANT_BOOL EnableFlatStyleByName(LPCTSTR sObjectName, VARIANT_BOOL bEnable);

VARIANT_BOOL EnableFlatStyleById(SHORT usObjectId, VARIANT_BOOL bEnable);

Parameters
sObjectName
The name of the target widget.
usObjectId
The id of the target widget.
bEnable
Enables or disables the submit mode.
Return Value

EnableSubmitMode returns TRUE on success, FALSE otherwise. To get extended information, call WStError::GetLastErrorCode.

Remarks

The event type senty by a WS_FIELD is always WS_EVENT_TEXT_INPUT, but this behavior can be modified and force the widget to sent a different event type if it is forced to trigger its input event. In order to change the default behavior you have to change the client configuration, the parameter UseTextSubmitEvent in the _EVENTS section must be set to "Yes". So, when a WS_FIELD is forced to trigger its input event, it will send a WS_EVENT_TEXT_SUBMIT event instead of a WS_EVENT_TEXT_INPUT.

Example
C#
using WirelessStudioOleWidgets;
WStWidget oWidget = new WStWidget();
WStFactory oFactory = new WStFactory();
short sButtonId = 4;
oFactory.CreateWidgetById((short)WSTFactoryConstants.WS_BUTTON, sButtonId, "", 0,0, 50, 50, "");
oWidget.EnableSubmiteModeById(iButtonId, TRUE);
Visual Basic 6 (Full Example: MessageBoxDemoModule.bas.txt)
Public wsWidget As New WStWidget
Public wsFactory As New WStFactory
..
'Enables the submit mode on the main button, the texts of the
' msgBoxText and msgBoxCaption fields will be sent before
' the click event on the showMessageBoxBtn is processed
wsWidget.EnableSubmitModeByName "showMessageBoxBtn", True
...
See also

GetText

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