1 / 14

DataFlex Web Framework Symposium – Part 7.5 Web Framework Modal Objects

DataFlex Web Framework Symposium – Part 7.5 Web Framework Modal Objects. John Tuohy Development Team www.dataaccess.com. Modal Objects. The web framework supports Modal objects Supports: Message Boxes Modal Dialogs We provide the classes and interface to make this all work

cargan
Download Presentation

DataFlex Web Framework Symposium – Part 7.5 Web Framework Modal Objects

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. DataFlex Web Framework Symposium – Part 7.5Web Framework Modal Objects John Tuohy Development Team www.dataaccess.com

  2. Modal Objects • The web framework supports Modal objects • Supports: • Message Boxes • Modal Dialogs • We provide the classes and interface to make this all work • There are special web considerations

  3. Handling Events • The client/server event cycle • The client • Generates an event. If a server event it sends a request to the server • The server • Attaches process and synchronizes • Sends the event to the corresponding DataFlex object • Which, might change web property values and queue client actions • Generates a response and detaches from the process • The client • Handles the response by synchronizing web properties and executing required client actions

  4. Modal Objects // Create a Hello World Button Object oButton is a cWebButton Set psCaption to “Save" Procedure OnClick Send ShowInfoBox of oWebApp "Hello world!" End_Procedure End_Object 5

  5. Modal Objects Modality using a windows-like approach Object oButton is a cWebButton Procedure OnClick Integer eConfirmMode // invoke modal dialog which asks question Get ShowYesNo of oWebApp "Are you sure?" "Confirmation" to eConfirmMode // handle the response If (eConfirmMode =MBR_Yes) Begin Send DoAction End End_Procedure End_Object This will not work, can you see why?

  6. Handling Events

  7. Modal Objects • With web modal dialogs you are going to need an extra client-server round trip • OnClick request is sent to server • Server tells client to display the modal dialog and disconnects • Upon completion client must send a message back to the server with the results • The Server processes the results and disconnects Q: How does the client know what message and object to callback in step 3? A: A callback object and message must be passed in step 2.

  8. Modal Objects Modality using the web approach – this works Object oButton is a cWebButton Procedure ConfirmResponse Integer eConfirmMode If (eConfirmMode = cmYes) Begin Send DoAction End End_Procedure // Publish the response method WebPublishProcedure ConfirmResponse Procedure OnClick Integer eAnswer Send ShowYesNo of oWebApp (Self) (RefProc(ConfirmResponse) "Are you sure?" "Confirmation" End_Procedure End_Object

  9. Modal Objects • Message Boxes • ShowInfoBox • Used to show an information box • Single Ok button, no callback • ShowYes • Used to show a Yes/No dialog • You pass the callback object and callback message • ShowMessageBox • Used or custom multi-button message boxes • You pass the callback object and callback message

  10. Modal Objects • Modal Dialogs • Based on cWebModalDialog class • Is invoked by sending Popup passing the callback object • Upon completion the client sends a server requests which sends OnCloseModalDialog to the callback object Procedure OnCloseModalDialog Handle hoModalDialog String sAnswer Get GetAnswerName of hoModalDialog to sAnswer Send ShowInfoBox ("Your name is " + sAnswer) End_Procedure Procedure OnClick Send InitializeDialog of oDemoQuestionDialog "Question" "What is your name?" Send Popup of oDemoQuestionDialog Self End_Procedure

  11. Modal Dialogs The Invoking Object Object oAskQuestion is a cWebButton Set psCaption to "Ask Name" Procedure OnCloseModalDialog Handle hoModalDialog String sAnswer Get GetAnswers of hoModalDialog to sAnswer Send ShowInfoBox ("Your name =" + sAnswer) End_Procedure Procedure OnClick Send InitializeDialog of oDemoQuestionDialog "What is your name?" Send Popup of oDemoQuestionDialog Self End_Procedure The Modal Dialog Object oDemoQuestionDialog is a cWebModalDialog // user inteface goes here Function GetAnswers Returns String String sReponse WebGet psValue of oResponseFrm to sResponse Function_Return sReponse End_Function Procedure InitializeDialog String sQuestion WebSet psCaption of oQuestionLbl to sQuestion WebSet psValue of oResponseFrm to "" End_Procedure End_Object

  12. Modal Objects • To summarize • The web framework support modal popup objects by using callbacks • Supports: • Message Boxes • Modal Dialogs • An extra request/response cycle is required • A callback mechanism is required to make this work • Special interfaces are provided to make the callback mechanism easy to use and secure

  13. The End

More Related