// StatPnl.pkg - creates the standard status_panel object. // // // This is the default Status Panel object used by any of the Visual DataFlex classes that // invoke the standard status panel. The standard has always been that the package name // is StatPnl.pkg and the name of the object is Status_Panel. As of 12.0, there are major // changes in the way the status panel operates The Sentinel based external status panel used in // prior revisions has been replace with status panel that is part of the application. // This should work much better and faster than the old sentinel based solution. // While the way this operates has changed, the interface has not and therefore this should work // with most applications. // // As of 12.0, we have added a global handle that contains the object ID of this status panel. // This variable ghoStatusPanel can be used in place of the object name Status_Panel. This provides // a cleaner more robust interface. // // // Compatibility Note: // // When used in the standard way, this change will require no changes. A developer will only need to // change their code if they've modified the sentinel program, which was a difficult thing to do. // // If for some reason you application will not work using this as a replacement for the old status // panel, you've probably done something special with the old status-panel. If you don't want to // figure out how to use the new one and you want to continue using the old one you are going to need // to add some code to include the old status panel in your application. Add the following to your project (your src). // // Use StatPnl.pkg // Make sure you load the new status panel object first. this is not optional! // Use OldStatPnl.pkg // load the old status panel. Status_Panel is now this old object // // If you do this, you will lose access to the new status-panel via Status_Panel. However, you // can still access the new object via the ghoStatusPanel handle. // // // Creating your own Status Panel objects // // If a developer wishes to create a custom panel, they should use this package as their template. // This panel can be visually modeled and changed any way you wish. Just save your new custom panel // with a different file and object name and direct your status panel request to the new object. // // If the new panel changes the interface and updates objects that are not currently defined, you // want to make sure you send the message ProcessEvents after you've updated the object. This allows // the object to paint when inside of a tight loop. For example, if you wanted to add a progress // bar (cProgressBar) you would want to Send ProcessEvents after you update the progress bar. // e.g. // Procedure UpdateStatusBar // Send DoAdvance of oProgressBar // Send ProcessEvents // End_Procedure // // Of course, if you use the standard interfaces in status bar and your forward send these // messages this will be done for you. // // the standard Interface for status panels are: // // Send Initialize_StatusPanel - initializes values for caption, title & message // Send Start_StatusPanel - start the status panel // Send Stop_StatusPanel - stop the status panel // Send Update_StatusPanel - update the status panel's action area // Get Check_StatusPanel - check for cancel (if cancel or pbCancel is set, close the panel) // // Get/Set Caption_Text - updates the caption bar // Get/Set Title_Text - updates the title area // Get/Set Message_Text - updates the Message area // Get/Set Action_Text - updates the action area // Get/Set Button_Text - updates the button area // // Get/Set Allow_cancel_state - determines if panel can be canceled // Send EnableCancelButton - code you should provide to enable/disable cancel button // // ghoStatusPanel - global handle that points to the standard status panel. Use cProcessStatusPanel.pkg #IFNDEF ghoStatusPanel Global_Variable Handle ghoStatusPanel // will contain the ID of the global StatusPanel object #ENDIF Object Status_Panel is a cProcessStatusPanel Set Size to 120 300 Move Self to ghoStatusPanel // this can be used throughout your applicaton to access this object object oTitleTxt is a TextBox set location to 10 10 Set Auto_Size_State to False Set size to 20 280 Set Justification_Mode to JMode_Center end_object object oMessageTxt is a TextBox Set location to 38 10 Set Auto_Size_State to False Set size to 28 280 end_object object oActionTxt is a TextBox Set Size to 23 280 Set Auto_Size_State to False Set location to 74 10 Set Justification_Mode to JMode_Left end_object object oStopButton is a Button Set Location to 101 140 Set Label to C_$Cancel procedure OnClick send Close_panel end_procedure end_object // These messages bind the standard cProcessStatusPanel interface to the actual // objects defined within this instance of the status panel. // note: all of the messages that change text should be forwarded // as the forwarded messages allows the panel to paint when in a tight loop Procedure Set Message_Text string sText Set Label of oMessageTxt to sText Forward Set Message_Text to sText End_Procedure Function Message_Text returns string Function_Return (Label(oMessageTxt)) End_Function Procedure Set Action_Text string sText Set Label of oActionTxt to sText Forward Set Action_Text to sText End_Procedure Function Action_Text returns string Function_Return (Label(oActionTxt)) End_Function Procedure Set Button_Text string sText Set Label of oStopButton to sText Forward Set Button_Text to sText End_Procedure Function Button_Text returns string Function_Return (Label(oStopButton)) End_Function Procedure Set Title_Text string sText Set Label of oTitleTxt to sText Forward Set Title_Text to sText End_Procedure Function Title_Text returns string Function_Return (Label(oTitleTxt)) End_Function // gets called when status panel is activated passing whether a button // should appear Procedure EnableCancelButton boolean bEnable Set Enabled_State of oStopButton to bEnable end_procedure End_Object