dark_mode EN

WModalMsgTask

  • Inherits from: None

    File: zModalMsgTask.prg

This class allows you to create modal dialogs that can be assigned to any event of any HTML control. The dialog has a title, text, and as many buttons as you want, which can be assigned JavaScript code, the name of a JavaScript function that must exist in the display, or the name of a method within the object itself WDoc.

This class replaces the WModalMsgButton class, which was somewhat more complicated to use and was configured as a WPackage object when it wasn't really necessary. Example of use:

WITH OBJECT oModal := WModalMsgTask():New() 
:cTitle := "Title" 
:cBody := "Text" 
:AddButton( "OK", "<script>alert('OK');</script>" ) 
:AddButton( "XW event", "Act_click" ) 
:AddButton( "JS event", "js_click", .f. )
END WITH

WITH OBJECT WButton():New( Self ) 
:cText := "This button fires a modal dialog box" 
:OnClick := oModal 
:cId := "button1" 
:Load()
END WITH