How to work with modal windows
This chapter describes the creation and usage of modal windows in the PROMOTIC system.
is a window that blocks access and control of all other application windows while open
so the user can interact only with this window. After the modal window is closed the control is returned back to the window from which the modal window was opened.
The modal window is usually used for data entry (editing). The user is entering the entries and before the proces is completed the user is prevented from "leaving the window".
While the modal window is open, access the rest of the application is blocked, therefore it is necessary to think well before using such window. It is recommended to use such window only for simple data entry so it is not open for a long time.
How to create modal window
Asuming there is a graphic panel (PmaPanel
object), that contains one edit object PmgWCombo
and two control buttons PmgButton
1) In the onPanelStartEnd event
of the PmgRoot
object it is possible to read the Arguments property
and display it in the editing Pmg
2) In the onButtonUp event of the OK button
close the window with "ok"
3) In the onButtonUp event of the Cancel button
close the window with no flag.
4) In the onPanelStopEnd event
of the PmgRoot
object by means of the ReturnValue property
we send back the value read from the editing Pmg
How to open modal window and process the entered values once it is closed
Asuming there is a button (PmgButton
object) in the parent panel that opens the modal window. The example below describes the recommended way of passing and receiving values from modal window.
- into the Arguments
property set the input value of the modal window.
- into the onClose
property set the name of the function that is called on window closing.
Then the modal window is opened. Once it is closed, the returned value is processed in the "onClose
Script in the onButtonUp
event of the button:
Obsolete and therefore not recommended approach of modal window opening by the OpenViewModal
method. If this method is used then the modal window is opened synchronously
and therefore the script waits until the window is closed by the user. If the window is enabled for the Web, then problems may occure since some Web browsers do not support such approach (Chrome