Forum > General

[SOLVED] Hide property

<< < (2/2)

pcurtis:
@Mr.Madguy Job done. It works. Thanks.

Remy Lebeau:

--- Quote from: pcurtis on May 10, 2021, 07:11:51 pm ---@Remy Lebeau Means nothing to me  :(

--- End quote ---

It means you can register the THiddenPropertyEditor class for the property you want to hide at design-time (it will still be available at runtime), eg:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---unit MyTimer; {$mode objfpc}{$H+} interface uses  ...     type  TMyTimer = class(TTimer)    ...  end;     procedure Register;     implementation     {$R MyTimer.res} uses  PropEdits;     ...     procedure Register;begin  RegisterComponents('Misc', [TMyTimer]);  RegisterPropertyEditor(TypeInfo(Boolean), TMyTimer, 'Enabled', THiddenPropertyEditor);end; end.
But, using the approach of deriving TMyTimer from TCustomTimer and NOT promoting the Enabled property to published is a better way to go.  It also hides the Enabled property at runtime, too.  I wasn't aware that FreePascal had TCustomTimer (Delphi doesn't).

PascalDragon:

--- Quote from: Remy Lebeau on May 11, 2021, 02:56:24 am ---But, using the approach of deriving TMyTimer from TCustomTimer and NOT promoting the Enabled property to published is a better way to go.  It also hides the Enabled property at runtime, too.  I wasn't aware that FreePascal had TCustomTimer (Delphi doesn't).

--- End quote ---

It's more correct to say that Lazarus or the LCL has TCustomTimer, not Free Pascal. ;)

Mr.Madguy:

--- Quote from: Remy Lebeau on May 11, 2021, 02:56:24 am ---But, using the approach of deriving TMyTimer from TCustomTimer and NOT promoting the Enabled property to published is a better way to go.  It also hides the Enabled property at runtime, too.  I wasn't aware that FreePascal had TCustomTimer (Delphi doesn't).

--- End quote ---
Can't check it now - will do it later, but I think, that any control should have TCustom analog both in Delphi and Lazarus.

Navigation

[0] Message Index

[*] Previous page

Go to full version