//************************************************************************ // Confidential Trade Secret. // Copyright (c) 1997 Data Access Corporation, Miami Florida // as an unpublished work. All rights reserved. // DataFlex is a registered trademark of Data Access Corporation. // //************************************************************************ // // $File name : StatPnl.pkg // $File title : Status Panel Support for VDF // Notice : // $Author(s) : John Tuohy // // $Rev History // // SWB 11/15/00 Changed Start_StatusPanel, so that the Sentinel program could be a long-filename. // JT 5/18/00 Added code to keep panel on top. // JT 9/22/97 Added status_params, status_default_params and changed // interface for no-cancel, and created interface for additional // parameter passing // JT 06/27/97 Added no-cancel support w/ Allow_cancel_state // JT ??/??/96 File created for VDF 4.0 //************************************************************************ // Host/Sentinel Status Panel // use Windows.pkg use RDCSentDat.pkg // define shared data positions use msgbox.pkg 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 #IFNDEF Get_GetForegroundWindow External_Function GetForegroundWindow "GetForegroundWindow" User32.dll Returns Integer #ENDIF Class RDCStatusPanel is a DfObject Procedure Construct_Object Forward Send Construct_Object Property String Sentinel_Name public "RDCSentinel" Property Integer Sentinel_Running_State Public False Property Integer ProgressBar_State public False Property Integer Progress_Minimum public 0 Property Integer Progress_Maximum public 100 Property String Private.Button_text Public "" Property String Private.Title_Text Public "" Property String Private.Caption_Text Public "" Property String Private.Message_Text Public "" Property String Private.Action_Text Public "" Property String Private.License_Text Public "" Property Integer Allow_Cancel_State Public True // whenever a status is initialized, the default // is used unless a different value is passed in // initialize_StatusPanel property string status_params public '' property string Status_Default_params public '' Set Button_Text to "Cancel" End_Procedure // Construct_Object Procedure Close_Panel End_Procedure Procedure Initialize_StatusPanel String sCaption String sTitle ; String sMessage String sParams Set ProgressBar_State to False Set Caption_text to sCaption Set Title_Text to sTitle Set Message_Text to sMessage // the 4th param is optional because it was not supported // in vdf4. You are encouraged to supply this If num_arguments gt 3 ; set Status_params to sParams else ; set Status_params to (Status_Default_params(self)) End_Procedure Procedure Set Caption_Text string sText Send DoStatusPaneltoForeground Set Private.Caption_Text to sText Set SentinelData of Desktop to sText CAPTIONSTART CAPTIONLENGTH End_Procedure // Set Caption_Text Function Caption_Text returns string Function_Return (Private.Caption_Text(self)) End_Function // Caption_Text Procedure Set Message_Text string sText Send DoStatusPaneltoForeground Set Private.Message_Text to sText Set SentinelData of Desktop to sText MESSAGESTART MESSAGELENGTH End_Procedure // Set Message_Text Function Message_Text returns string Function_Return (Private.Message_Text(self)) End_Function // Message_Text Procedure Set Action_Text string sText Send DoStatusPaneltoForeground Set Private.Action_Text to sText Set SentinelData of Desktop to sText ACTIONSTART ACTIONLENGTH End_Procedure // Set Action_Text Function Action_Text returns string Function_Return (Private.Action_Text(self)) End_Function // Action_Text Procedure Set Button_Text string sText Send DoStatusPaneltoForeground Set Private.Button_Text to sText Set SentinelData of Desktop to sText BUTTONSTART BUTTONLENGTH End_Procedure // Set Button_Text Function Button_Text returns string Function_Return (Private.Button_Text(self)) End_Function // Button_Text Procedure Set Title_Text string sText Send DoStatusPaneltoForeground Set Private.Title_Text to sText Set SentinelData of Desktop to sText TITLESTART TITLELENGTH End_Procedure // Set Title_Text Function Title_Text returns string Function_Return (Private.Title_Text(self)) End_Function // Title_Text // 2002-10-14 ------------------------------------ Start Nils G. Svedmyr Procedure Set License_Text string sText Send DoStatusPaneltoForeground Set Private.License_Text to sText Set SentinelData of Desktop to sText LICENSESTART LICENSELENGTH End_Procedure // Set Title_Text Function License_Text returns string Function_Return (Private.License_Text(self)) End_Function // Title_Text // 2002-10-14 ------------------------------------ Stop Nils G. Svedmyr Procedure Start_StatusPanel Integer iVal String sParams If Not (Sentinel_Running_State(self)) Begin Get status_params to sParams If Not (Allow_Cancel_State(self)) ; Move (sParams * "-c0") to sParams Set Sentinel_Program of Desktop to ('"' + Sentinel_Name(self) +'"' * sParams) Get Start_Sentinel_Program of Desktop to iVal //showln "start sent = " ival //If iVal ; Set Sentinel_Running_State to TRUE End End_Procedure // Start_StatusPanel Procedure Update_StatusPanel String sAction Set Action_Text to sAction End_Procedure Function Check_StatusPanel returns integer integer iRet Send DoStatusPaneltoForeground Get Sentinel_return_value to iRet // modified to cancel the status panel if MSG_CANCEL is returned. This way you // don't have to remember to send Stop_StatusPanel If (iRet=MSG_CANCEL) Send Stop_StatusPanel Function_Return iRet End_Function // Do what we can to force the status panel to the top. If the main program gets // the focus force the status panel to take the focus. Procedure DoStatusPaneltoForeground integer hwStat hwMain hMain Get main_window to hMain If hMain Get window_handle of hMain to hwMain If hwMain Begin If (GetForegroundWindow()=hwMain) Begin Move (SentinelWindow(desktop)) to hwStat If hwStat Move (SetForegroundWindow(hwStat)) to hwStat End End End_procedure Procedure Stop_StatusPanel Integer iVal If (Sentinel_Running_State(self)) ; Get Stop_Sentinel_Program to iVal Set Sentinel_Running_State to False End_Procedure End_Class Object RDCStatus_Panel is a RDCStatusPanel End_Object