Module cProcessStatusPanel.pkg

     1// cProcessStatusPanel.pkg
     2//
     3// Class used to create StatusPanels.
     4//
     5// This class does not provide any of the inner objects that make up a status panel. Instead an
     6// interface is provided that is used to update the various areas of status panel. At this level,
     7// those areas (title area, message area, action area, button area) are logical. You create the
     8// physical objects at the object level and then bind these objects to the interface.
     9// Take a look at StatPnl.pkg to see how this is used.
    10//
    11// the standard Interface for status panels are:
    12//
    13// Send Initialize_StatusPanel - initializes values for caption, title & message
    14// Send Start_StatusPanel      - start the status panel
    15// Send Stop_StatusPanel       - stop the status panel
    16// Send Update_StatusPanel     - update the status panel's action area
    17// Get  Check_StatusPanel      - check for cancel (if cancel or pbCancel is set, close the panel)
    18//
    19// Get/Set Caption_Text - updates the caption bar
    20// Get/Set Title_Text   - updates the title area
    21// Get/Set Message_Text - updates the Message area
    22// Get/Set Action_Text  - updates the action area
    23// Get/Set Button_Text  - updates the button area
    24//
    25// Get/Set Allow_cancel_state - determines if panel can be canceled
    26// Send EnableCancelButton - code must be provided in the cancel button object to enable/disable cancel button
    27//
    28
    29Use cStatusPanel.pkg
    30
    31
    32
    33{ HelpTopic=cProcessStatusPanel }
    34Class cProcessStatusPanel is a cStatusPanel
    35
    36    Procedure Construct_Object
    37        Forward Send Construct_object
    38        // determines if panel can be canceled
    39        { Category=Behavior }
    40        Property boolean Allow_Cancel_State True
    41    End_procedure
    42
    43    // Any of the properties that change the text of a status panel must also send
    44    // ProcessEvents which allows the panel to process painting messages. The ProcessEvents
    45    // is essential when using status panels within a tight loop
    46
    47    { MethodType=Property }
    48    { Category="Appearance" }
    49    Procedure Set Caption_text string sText
    50        Set Label to sText
    51        Send ProcessEvents
    52    End_Procedure
    53
    54    { MethodType=Property }
    55    Function Caption_Text returns string
    56        Function_Return (Label(self))
    57    End_Function
    58
    59    { MethodType=Property }
    60    { Category="Appearance" }
    61    Procedure Set Message_Text String sText
    62        Send ProcessEvents
    63    End_Procedure
    64
    65    { MethodType=Property }
    66    Function Message_Text returns string
    67    End_Function
    68
    69    { MethodType=Property }
    70    { Category="Appearance" }
    71    Procedure Set Action_Text String sText
    72        Send ProcessEvents
    73    End_Procedure
    74
    75    { MethodType=Property }
    76    Function Action_Text returns string
    77    End_Function
    78
    79    { MethodType=Property }
    80    { Category="Appearance" }
    81    Procedure Set Button_Text String sText
    82        Send ProcessEvents
    83    End_Procedure
    84
    85    { MethodType=Property }
    86    Function Button_Text returns string
    87    End_Function
    88
    89    { MethodType=Property }
    90    { Category="Appearance" }
    91    Procedure Set Title_Text String sText
    92        Send ProcessEvents
    93    End_Procedure
    94
    95    { MethodType=Property }
    96    Function Title_Text returns string
    97    End_Function
    98
    99    // initializes values for caption, title & message
   100    Procedure Initialize_StatusPanel String sCaption String sTitle string sMessage
   101        Set Caption_text to sCaption
   102        Set Title_Text   to sTitle
   103        Set Message_Text to sMessage
   104    End_Procedure
   105
   106    // update the status panel's action area
   107    Procedure Update_StatusPanel String sAction
   108        Set Action_Text to sAction
   109    End_Procedure
   110
   111    // stop the status panel
   112    Procedure Close_Panel
   113        If (Allow_cancel_state(self)) begin
   114            Forward Send Close_Panel
   115        end
   116    End_procedure
   117
   118    // Code must be provided in the cancel button object to enable/disable cancel button
   119    Procedure EnableCancelButton boolean bEnable
   120    End_procedure
   121
   122    // check for cancel (if cancel or pbCancel is set, close the panel)
   123    Function Check_StatusPanel returns integer
   124        Boolean bCancel
   125        If (Active_state(self)) Begin
   126            Send ProcessEvents
   127            Get pbCancel to bCancel
   128            If bCancel begin
   129                Send Stop_StatusPanel // the old status panel removed this when canceled.
   130            end
   131        end
   132        Function_Return (If(bCancel, MSG_CANCEL, 0)) // the old check status panel returns msg_cancel
   133    End_Function
   134
   135    // start the status panel
   136    Procedure Start_StatusPanel
   137        If Not (Active_state(self)) Begin
   138            Send EnableCancelButton (Allow_cancel_state(self))
   139            Send Activate
   140        End
   141    End_Procedure
   142
   143    // stop the status panel
   144    Procedure Stop_StatusPanel
   145        If (Active_state(self)) Begin
   146            Send Deactivate
   147        End
   148    End_Procedure
   149
   150End_Class
   151
   152