//**************************************************************************** // $Module type: Package // $Module name: cRDCCommandLinkButton.pkg // // $Author : Nils Svedmyr, RDC Tools International. // Copyright (c) 2018 RDC Tools International // E-mail : support@rdctools.com // Web-site : http://www.rdctools.com // // Created : 2018-11-09 @ 17: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 cCommandLinkButton.pkg Use Enclient.pkg Use errornum.inc Class cRDCCommandLinkButtonIdleHandler is a cIdleHandler Procedure Construct_Object Forward Send Construct_Object End_Procedure Procedure OnIdle Delegate Send DoUpdate End_Procedure End_Class Class cRDCCommandLinkButton is a cCommandLinkButton Procedure Construct_Object Forward Send Construct_Object { MethodType=Property InitialValue=False } { Category=Appearance } Property Boolean pbAutoEnable True { Visibility=Private } Property Boolean pbEnabled True Property Handle phoIdleHandler (Create(Self, RefClass(cRDCCommandLinkButtonIdleHandler))) Set Border_Style to Border_Normal Set piImageSize to 32 Set pbCenterToolTip to True End_Procedure Procedure End_Construct_Object String sTooltip sStatus_Help Forward Send End_Construct_Object Get psToolTip to sTooltip Get Status_Help to sStatus_Help If (sTooltip = "" and sStatus_Help <> "") Begin Set psToolTip to sStatus_Help End 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 Procedure Set Color Integer eColor Forward Set Color to clBtnFace End_Procedure End_Class