//**************************************************************************** // $Module type: Class // $Module name: cZeroLogBn.pkg // $Author : Nils G. Svedmyr // Created : 2001-09-07 @ 17:52 // // Description : // // $Rev History: // 2001-09-07 Module header created //**************************************************************************** //Use cRDSButton.pkg Use cBitmapButton.pkg Use Working Open SncSys Open SncLog Register_Object SncLog_DD Class cZeroLogBn Is A cBitmapButton //cRDSButton Procedure Construct_Object Forward Send Construct_Object Set piTransparentColor To clFuchsia End_Procedure // Construct_Object Procedure End_Construct_Object Forward Send End_Construct_Object End_Procedure // End_Construct_Object Procedure OnClick Handle ho Integer iRetval Boolean bOk String sFile Get YesNo_Box "Are you sure you want to delate all records in the log?" To iRetval If (iRetval = MBR_NO) Procedure_Return If (Active_State(Self)) Send StartWorkingMessage "Deleting Log data..." Send Cursor_Wait Of (Cursor_Control(Self)) // Hourglass // Delegate Get oDbLog_lst to ho Move (oSncLog_grd(Self)) To ho Close SncLog Send Ignore_Error Of Error_Info_Object 75 Send Ignore_Error Of Error_Info_Object 4177 Open SncLog Mode DF_EXCLUSIVE If Not (Found) Begin Close SncLog Open SncLog End // If Not (Found) Begin Else Begin Zerofile SncLog Move (True) To bOk End // Else Begin If Not bOk Begin Send StopWorkingMessage Send Cursor_Ready Of (Cursor_Control(Self)) // hourglass Get YesNo_Box ; "Could not open the file/table in exclusive mode. It is open by another user or application on this machine. Do you want to delete it record by record? (This can take considerable time if there are many log records.)" To iRetval If (iRetval = MBR_YES) Begin If (Active_State(Self)) Send StartWorkingMessage "Deleting Log data..." Send Cursor_Wait Of (Cursor_Control(Self)) // Hourglass If ho Set Dynamic_Update_State Of ho To False Clear SncLog Repeat Find Gt SncLog.Recid If (Found) Delete SncLog Until (Not(Found)) Move (True) To bOk If ho Begin Set Dynamic_Update_State Of ho To True Send Ignore_Error Of Error_Info_Object 25 Send Beginning_Of_Data Of ho Send Trap_Error Of Error_Info_Object 25 End // If ho Begin End // If (iRetval = MBR_YES) Begin End // If Not bOk Begin If bOk Begin Reread SncSys Move 0 To SncSys.Log_Recid Saverecord SncSys Unlock End // If bOk Begin Send Trap_Error Of Error_Info_Object 75 Send Trap_Error Of Error_Info_Object 4177 If ho Begin Set Dynamic_Update_State Of ho To True Send Beginning_Of_Data Of ho End // If ho Begin Send StopWorkingMessage Send Cursor_Ready Of (Cursor_Control(Self)) // hourglass End_Procedure // OnClickEnd_Class // cZeroLogBn // Procedure Set pbToolTips Boolean bState // Handle ho // If (bState = False) Begin // Get phoToolBar To ho // Set pbToolTips Of ho To False // End // If (bState = False) Begin // End_Procedure // Set pbToolTips End_Class // cZeroLogBn