0% found this document useful (0 votes)
45 views

Alertonce PMLFRM

This document defines a form in PML code to display a confirmation dialog. The form has methods to initialize it, set the confirmation response, and toggle a global variable to not display the form again. It ensures a confirmation response is set before closing.

Uploaded by

YoussefOuchrif
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views

Alertonce PMLFRM

This document defines a form in PML code to display a confirmation dialog. The form has methods to initialize it, set the confirmation response, and toggle a global variable to not display the form again. It ensures a confirmation response is set before closing.

Uploaded by

YoussefOuchrif
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

------------------------------------------------------------------------

--
-- Copyright 1974 to current year. AVEVA Solutions Limited and its subsidiaries.
All rights reserved in original code only.
--
-- File: alertonce.pmlfrm
-- Type: Form Definition
-- Group: Alerts
--
-- Keyword: CONFIRM
-- Module: ALL
-- Replaces:
--
-- Author: andy.kirkland
-- Created: Fri Mar 19 14:17:58 2004
--
--
-- Description:
-- Form to switch off confirmation if requested
--
------------------------------------------------------------------------
--
-- Methods defined:
--
-- Method call Return Description
-- =========== ====== ===========
-- alertOnce() - Constructor
-- close() - close form
-- confirm(STRING) - Set the confirm flag for
continuing or stopping
-- dontAskMe() - Method to set the global
switch from the toggle
-- initialise() - initialise
--
------------------------------------------------------------------------
layout form !!alertOnce blocking

member .confirm is BOOLEAN


member .default is STRING
member .globalSwitch is STRING

para .icon pixmap "%pmllib%/icons/splash/qm35.png"

para .question at xmax+2 ymin+0.5 text ' '


lines 3
toggle .dontAskMeAgain at x3 ymax |Do not ask me again.|
-- OK and Cancel are not working in blocking forms
button .yes at xmax form-9.2-size ymax+0.2 'Yes' tooltip 'Yes' width 8

button .no at xmax form-size 'No' tooltip 'No' width 8

exit
-- End of form definition for !!alertOnce
------------------------------------------------------------------------
--
-- Method: alertOnce()
--
-- Description: Constructor
--
-- Method Type: Function/Procedure
-- Arguments:
-- [#] [R/RW] [Data Type] [Description]
-- Return:
-- [Data Type] [Description]
--
------------------------------------------------------------------------
define method .alertOnce()

-- form setup
!this.formTitle = 'Confirm'
!this.iconTitle = 'Confirm'
!this.cancelCall = '!this.close()'
!this.callback = '!this.initialise()'
!this.formRevision = '$Revision: 1.2 $ '

!this.yes.callback = '!this.confirm(|YES|)'
!this.no.callback = '!this.confirm(|NO|)'
!this.confirm = FALSE
!this.dontAskMeAgain.callback = '!this.dontAskMe()'
!this.default = 'YES'
-- this is just an example. This is set by the calling function/method
!this.globalSwitch = '!!draAddSheets'

endmethod
-- End of method definition for .alertOnce()
------------------------------------------------------------------------
--
-- Method: initialise()
--
-- Description: initialise
--
-- Method Type: Function/Procedure
-- Arguments:
-- [#] [R/RW] [Data Type] [Description]
-- Return:
-- [Data Type] [Description]
--
------------------------------------------------------------------------
define method .initialise()
-- this isn't working at present
!this.attribute(!this.default).setFocus()
-- check to see if gvar is string or the gvar in total
if(!this.globalSwitch.match('!').eq(0)) then
!gvar = '!!' + !this.globalSwitch
else
!gvar = !this.globalSwitch
endif
-- set the global variable so this form is not shown again for this gvar
if(defined($!gvar) and $!gvar) then
!this.dontAskMeAgain.val = TRUE
else
!this.dontAskMeAgain.val = FALSE
endif

endmethod
-- End of method definition for .initialise()
------------------------------------------------------------------------
--
-- Method: confirm
--
-- Description: Set the confirm flag for continuing or stopping
--
-- Method Type: Function/Procedure
-- Arguments:
-- [#] [R/RW] [Data Type] [Description]
-- [1] [R] [STRING] [Confirmation YES or NO]
-- Return:
-- [Data Type] [Description]
--
------------------------------------------------------------------------
define method .confirm(!yesOrNo is STRING)

if(!yesOrNo.eq('YES')) then
!this.confirm = TRUE
else
!this.confirm = FALSE
endif

!this.close()

endmethod
-- End of method definition for confirm()
------------------------------------------------------------------------
--
-- Method: dontAskMe
--
-- Description: Method to set the global switch from the toggle
--
-- Method Type: Function/Procedure
-- Arguments:
-- [#] [R/RW] [Data Type] [Description]
-- Return:
-- [Data Type] [Description]
--
------------------------------------------------------------------------
define method .dontAskMe()

-- check to see if passed as a gvar string or the gvar in total


if(!this.globalSwitch.match('!').eq(0)) then
!gvar = '!!' + !this.globalSwitch
else
!gvar = !this.globalSwitch
endif
-- set the global variable, so as not to show this form again
if(!this.dontAskMeAgain.val) then
$!gvar = TRUE
else
$!gvar = FALSE
endif

endmethod
-- End of method definition for dontAskMe()
------------------------------------------------------------------------
--
-- Method: close
--
-- Description: close form
--
-- Method Type: Function/Procedure
-- Arguments:
-- [#] [R/RW] [Data Type] [Description]
-- Return:
-- [Data Type] [Description]
--
------------------------------------------------------------------------
define method .close()

!this.hide()

endmethod
-- End of method definition for close()

You might also like