//**************************************************************************** // $Module type: Package // $Module name: cRDCButton.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 DoUpdate End_Procedure End_Class Class cRDCButton is a Button Procedure Construct_Object Forward Send Construct_Object { MethodType=Property InitialValue=False Category=Appearance } Property Boolean pbAutoEnable False { Visibility=Private } Property Boolean pbEnabled True Property Handle phoIdleHandler (Create(Self, RefClass(cButtonIdleHandler))) On_Key kCancel Send CancelIfPopupObject End_Procedure Procedure CancelIfPopupObject Boolean bIsInPopupObject Delegate Get Popup_State to bIsInPopupObject If (bIsInPopupObject = True) Begin Send Close_Panel End 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 If (sTooltip <> "" and sStatus_Help = "") Begin Set Status_Help to sToolTip End #ENDIF Set pbEnabled of (phoIdleHandler(Self)) to (pbAutoEnable(Self)) End_Procedure { Visibility=Private } Procedure DoUpdate If (pbAutoEnable(Self) = False) Begin Procedure_Return End Set Enabled_State to (IsEnabled(Self)) End_Procedure { MethodType=Event } Function IsEnabled Returns Boolean Boolean bEnabled Get pbEnabled to bEnabled Function_Return bEnabled End_Function // Enable the idle handler timer when the button is activated Procedure Activating Forward Send Activating Set pbEnabled of (phoIdleHandler(Self)) to True End_Procedure // Disable the idle handler when the button is deactivated Procedure Deactivating Set pbEnabled of (phoIdleHandler(Self)) to False Forward Send Deactivating End_Procedure End_Class