SetActionMode - cBaseLocalControlHost
Allows developer to configure a wait dialog for every server action
Type: Procedure
Parameters
| Parameter | Type | Description |
|---|---|---|
| hMessage | Handle | Message handle |
| eMode | Integer | Valid values are:ConstantMeaning |
| sOptWaitMessage | String | (Optional) Message to display |
Syntax
Procedure SetActionMode Handle hMessage Integer eMode String sOptWaitMessage
Call Example
Send SetActionMode hMessage eMode sOptWaitMessage
Description
This advanced feature allows developers to configure a wait dialog for every server action just as you can with the pbShowWaitDialog property of the cWebButton class.
Instead of adding properties for every server action, a procedure is available that tells the JavaScript Engine to send an action in a specific mode. The SetActionMode procedure takes a message handle to the published procedure or function as a parameter.
Sample
This example shows how to show a wait dialog can be shown while processing the OnClick of a menu item (cWebMenuItem). Other action modes that are available are: scModeWait, which will lock the UI and show a wait cursor and scModeDefault, which doesn't lock the UI and doesn't show a wait cursor.
Object oMenuItem is a cWebMenuItem
Set psCaption to "Long process"
Procedure OnLoad
Forward Send OnLoad
Send SetActionMode (RefProc(OnClick)) scModeProgress "Please wait while sleeping..."
End_Procedure
Procedure OnClick
// Do something long
Sleep 4
End_Procedure
End_Object
When a server action triggers another server action (like ProcessDataSet on cWebList), then it will keep the wait dialog on the screen until the new server action is processed.
Sample
This sample shows how to combine SetActionMode with a callback button that allows for confirmation of process execution prior to starting the process.
Procedure LongProcess
Sleep 30
End_Procedure
WebPublishProcedure LongProcess
Object oWebButton1 is a cWebButton
Set piColumnSpan to 0
Set psCaption to "Progress Process with confirmation"
Procedure ButtonCallback Integer eConfirmMode
If (eConfirmMode=cmYes) Begin
Send CallBack of oDemoDialogs (RefProc(LongProcess))
End
End_Procedure
WebPublishProcedure ButtonCallback
Procedure OnClick
Send ShowYesNo Self (RefProc(ButtonCallback)) "Confirm executing LongProcess"
End_Procedure
End_Object
Procedure OnLoad
Forward Send OnLoad
Send SetActionMode (RefProc(LongProcess)) scModeProgress "LongProcess is running. please wait!"
End_Procedure
Note: You can only mark published messages that the client sends to the server this way.
See Also