1// StatPnl.pkg - creates the standard status_panel object. 2// 3// 4// This is the default Status Panel object used by any of the Visual DataFlex classes that 5// invoke the standard status panel. The standard has always been that the package name 6// is StatPnl.pkg and the name of the object is Status_Panel. As of 12.0, there are major 7// changes in the way the status panel operates The Sentinel based external status panel used in 8// prior revisions has been replace with status panel that is part of the application. 9// This should work much better and faster than the old sentinel based solution. 10// While the way this operates has changed, the interface has not and therefore this should work 11// with most applications. 12// 13// As of 12.0, we have added a global handle that contains the object ID of this status panel. 14// This variable ghoStatusPanel can be used in place of the object name Status_Panel. This provides 15// a cleaner more robust interface. 16// 17// 18// Compatibility Note: 19// 20// When used in the standard way, this change will require no changes. A developer will only need to 21// change their code if they've modified the sentinel program, which was a difficult thing to do. 22// 23// If for some reason you application will not work using this as a replacement for the old status 24// panel, you've probably done something special with the old status-panel. If you don't want to 25// figure out how to use the new one and you want to continue using the old one you are going to need 26// to add some code to include the old status panel in your application. Add the following to your project (your src). 27// 28// Use StatPnl.pkg // Make sure you load the new status panel object first. this is not optional! 29// Use OldStatPnl.pkg // load the old status panel. Status_Panel is now this old object 30// 31// If you do this, you will lose access to the new status-panel via Status_Panel. However, you 32// can still access the new object via the ghoStatusPanel handle. 33// 34// 35// Creating your own Status Panel objects 36// 37// If a developer wishes to create a custom panel, they should use this package as their template. 38// This panel can be visually modeled and changed any way you wish. Just save your new custom panel 39// with a different file and object name and direct your status panel request to the new object. 40// 41// If the new panel changes the interface and updates objects that are not currently defined, you 42// want to make sure you send the message ProcessEvents after you've updated the object. This allows 43// the object to paint when inside of a tight loop. For example, if you wanted to add a progress 44// bar (cProgressBar) you would want to Send ProcessEvents after you update the progress bar. 45// e.g. 46// Procedure UpdateStatusBar 47// Send DoAdvance of oProgressBar 48// Send ProcessEvents 49// End_Procedure 50// 51// Of course, if you use the standard interfaces in status bar and your forward send these 52// messages this will be done for you. 53// 54// the standard Interface for status panels are: 55// 56// Send Initialize_StatusPanel - initializes values for caption, title & message 57// Send Start_StatusPanel - start the status panel 58// Send Stop_StatusPanel - stop the status panel 59// Send Update_StatusPanel - update the status panel's action area 60// Get Check_StatusPanel - check for cancel (if cancel or pbCancel is set, close the panel) 61// 62// Get/Set Caption_Text - updates the caption bar 63// Get/Set Title_Text - updates the title area 64// Get/Set Message_Text - updates the Message area 65// Get/Set Action_Text - updates the action area 66// Get/Set Button_Text - updates the button area 67// 68// Get/Set Allow_cancel_state - determines if panel can be canceled 69// Send EnableCancelButton - code you should provide to enable/disable cancel button 70// 71// ghoStatusPanel - global handle that points to the standard status panel. 72 73Use cProcessStatusPanel.pkg 74 75 76Global_Variable Handle ghoStatusPanel // will contain the ID of the global StatusPanel object 77 78 79Object Status_Panel is a cProcessStatusPanel 80 81 Move Self to ghoStatusPanel // this can be used throughout your applicaton to access this object 82 83 Set Size to 80 166 84 85 object oTitleTxt is a TextBox 86 set location to 10 10 87 Set Auto_Size_State to False 88 Set size to 20 150 89 Set Justification_Mode to JMode_Center 90 end_object 91 92 object oMessageTxt is a TextBox 93 set location to 25 10 94 Set Auto_Size_State to False 95 Set size to 20 150 96 end_object 97 98 object oActionTxt is a TextBox 99 set location to 45 10 100 end_object 101 102 object oStopButton is a Button 103 Set Location to 60 58 104 Set Label to C_$Cancel 105 106 procedure OnClick 107 send Close_panel 108 end_procedure 109 110 end_object 111 112 // These messages bind the standard cProcessStatusPanel interface to the actual 113 // objects defined within this instance of the status panel. 114 115 // note: all of the messages that change text should be forwarded 116 // as the forwarded messages allows the panel to paint when in a tight loop 117 118 Procedure Set Message_Text string sText 119 Set Label of oMessageTxt to sText 120 Forward Set Message_Text to sText 121 End_Procedure 122 123 Function Message_Text returns string 124 Function_Return (Label(oMessageTxt)) 125 End_Function 126 127 Procedure Set Action_Text string sText 128 Set Label of oActionTxt to sText 129 Forward Set Action_Text to sText 130 End_Procedure 131 132 Function Action_Text returns string 133 Function_Return (Label(oActionTxt)) 134 End_Function 135 136 Procedure Set Button_Text string sText 137 Set Label of oStopButton to sText 138 Forward Set Button_Text to sText 139 End_Procedure 140 141 Function Button_Text returns string 142 Function_Return (Label(oStopButton)) 143 End_Function 144 145 Procedure Set Title_Text string sText 146 Set Label of oTitleTxt to sText 147 Forward Set Title_Text to sText 148 End_Procedure 149 150 Function Title_Text returns string 151 Function_Return (Label(oTitleTxt)) 152 End_Function 153 154 // gets called when status panel is activated passing whether a button 155 // should appear 156 Procedure EnableCancelButton boolean bEnable 157 Set Enabled_State of oStopButton to bEnable 158 end_procedure 159 160End_Object