//**************************************************************************** // $Module type: Package // $Module name: cButton.pkg // // $Author : Nils Svedmyr, RDC Tools International. // Copyright (c) 2013 RDC Tools International // E-mail : support@rdctools.com // Web-site : http://www.rdctools.com // // Created : 2013-01-05 @ 19:04 (Military date format - Year-Month-Day) // // The code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; // without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. // This is free software; you can redistribute it and/or modify it under the terms of the // GNU Lesser General Public License - see the "GNU Lesser General Public License.txt" // in the help folder for more details. // //**************************************************************************** Use Windows.pkg Use Enclient.pkg Use errornum.inc Class cButtonIdleHandler is a cIdleHandler Procedure Construct_Object Forward Send Construct_Object End_Procedure Procedure OnIdle Delegate Send DoEnable End_Procedure End_Class Class cButton is a Button Procedure Construct_Object Forward Send Construct_Object Property Boolean pbAutoEnable False Object oButtonIdleHandler is a cButtonIdleHandler End_Object End_Procedure Procedure End_Construct_Object String sTooltip sStatus_Help Forward Send End_Construct_Object #IF (!@ > 150) Get psToolTip to sTooltip Get Status_Help to sStatus_Help If (sTooltip = "" and sStatus_Help <> "") Begin Set psToolTip to sStatus_Help End #ENDIF Set pbEnabled of oButtonIdleHandler to (pbAutoEnable(Self)) End_Procedure { MethodType=Event } Procedure DoEnable Boolean bAutoEnable bHasRecord Handle hoDD Get pbAutoEnable to bAutoEnable If (bAutoEnable = False) Begin Procedure_Return End Send Ignore_Error of Error_Object_Id DFERR_BAD_MESSAGE Move (Main_DD(Self)) to hoDD Send Trap_Error of Error_Object_Id DFERR_BAD_MESSAGE If (hoDD <> 0) Begin Get HasRecord of hoDD to bHasRecord End Set Enabled_State to (bHasRecord = True) End_Procedure // Enable the idle handler timer when the button is activated Procedure Activating Forward Send Activating Set pbEnabled of oButtonIdleHandler to True End_Procedure // Disable the idle handler when the button is deactivated Procedure Deactivating Set pbEnabled of oButtonIdleHandler to False Forward Send Deactivating End_Procedure End_Class