! $Id: toolConfigAndProgress_Config_ui.pvc.pvxsrc 41885 2022-03-09 14:56:24Z fmcguirk $

! Description of program

! $Copyright:$

 

 

def class "toolConfigAndProgress_Config_ui" create required delete required

 

    ! Inherits from the following class(es)

    like "ecCommonUI"

 

    ! Local/Private Properties

 

    ! ** [object] Reference to local instance of ecCommon

    local coCommon

    ! ** [string] prefix to use for data values in Eclipse data store

    local cPrefStorePfx$ = "toolConfigAndProgress"

    ! ** [string] List of fields names of data values managed by form

    local cDataVars$ = "workDesc$,workUnits,workDelay"

 

    ! Public Properties

 

    ! ** Initial panel to be loaded for the configuration information

    property screen_id$="dConfig"

    ! ** The library for the panel definitions

    property screen_lib$="toolConfigAndProgress.M4L"

 

    ! Public Functions (Methods)

 

    ! ** Set default values for fields

    function SetDefaults()                            set_defaults

 

    ! Local/Private Functions (Methods)

 

    ! ** Method that is executed when the 'Cancel' button is pressed.

    function local bt_cancel()                        bt_cancel

    ! ** Method that is executed when the 'OK' button is pressed.

    function local bt_ok()                            bt_ok

    ! ** Method  called when WorkDesc field changes

    function local ChangeWorkDesc()                   Change_Work_Desc

    ! ** Method  called when WorkDelay field changes

    function local ChangeWorkDelay()                  Change_Work_Delay

    ! ** Method  called when WorkUnits field changes

    function local ChangeWorkUnits()                  Change_Work_Units

 

    ! ** Method call after panel loaded

    function local PostLoad()                         post_load

 

end def

 

 

On_Create:

 

    coCommon = new("ecCommon")

 

    return

 

 

on_delete:

 

    drop object coCommon, err=*proceed; coCommon = 0

 

    return

 

 

bt_cancel:

 

    exitStatus = 1

    CMD_STR$   = "END"

 

    return 1

 

 

bt_ok:

 

    ! Save field list and data values to Eclipse preference store

    coCommon'Prefs("Set", cPrefStorePfx$+"_Fields", cDataVars$)

    coCommon'Prefs("Set", cPrefStorePfx$+"_Data", rec(cpl("iolist " + cDataVars$)))

 

    exitStatus = 1

    CMD_STR$   = "END"

 

    return 1

 

 

Change_Work_Desc:

 

    ! Perform data checks, if necessary

 

    return 1

 

 

Change_Work_Delay:

 

    ! Only allow value between 2 and 10

    retVal = (workDelay > 1 and workDelay <= 10)

 

    return retVal

 

 

Change_Work_Units:

 

    ! Only allow value between 2 and 10

    retVal = (workUnits > 1 and workUnits <= 10)

 

    return retVal

 

 

post_load:

 

    local dataRec$, dataVars$

 

    ! Get field list and data to Eclipse preference store

    coCommon'Prefs("Get", cPrefStorePfx$+"_Fields", dataVars$)

    coCommon'Prefs("Get", cPrefStorePfx$+"_Data",   dataRec$)

 

    ! First, clear expecterd data variable values

    read data from $$ to iol=cpl("iolist " + cDataVars$)

 

    ! Second, set data values retrieved from Eclipse preference store

    if not(nul(dataRec$)) and not(nul(dataVars$)) {

        read data from dataRec$ to iol=cpl("iolist " + dataVars$)

    }

 

    return 1

 

set_defaults:

 

    local dataVars$, dataRec$

 

    ! Get field list and data to Eclipse preference store

    coCommon'Prefs("Get", cPrefStorePfx$+"_Fields", dataVars$)

    coCommon'Prefs("Get", cPrefStorePfx$+"_Data",   dataRec$)

 

    if nul(dataVars$) or nul(dataRec$) {

        dataRec$ = "Work" + SEP + "2" + SEP + "2"

 

        ! Save field list and data values to Eclipse preference store

        coCommon'Prefs("Set", cPrefStorePfx$+"_Fields", cDataVars$)

        coCommon'Prefs("Set", cPrefStorePfx$+"_Data", dataRec$)

    }

 

    return 1