Recent

Author Topic: [SOLVED] Issue with custom controls  (Read 265 times)

CM630

  • Hero Member
  • *****
  • Posts: 1527
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
[SOLVED] Issue with custom controls
« on: October 13, 2025, 04:06:54 pm »
I have a custom control with custom (published) properties.
I want to create the control and execute a routine, after all values of the custom control are applied (accepted).
Refresh and invalidate do not help.
Any idea how to do it?


Code: Pascal  [Select][+][-]
  1. TCustomControl = class(TCustomComboBox)
  2.     private
  3.       FAppendFriendlyNames : Boolean;
  4. ...
  5.     public
  6. ...
  7.     published
  8.       property AppendFriendlyNames : boolean read FAppendFriendlyNames write FAppendFriendlyNames ;
  9. ...
  10.  
  11.  
  12. constructor TCustomControl.Create (aOwner: TComponent);
  13. begin
  14.   inherited Create(aOwner);
  15.   FAppendFriendlyNames := True; //Set the default value
  16.   WAIT UNTIL CUSTOM PROPERTIES GET ITS VALUES
  17.   ShowMessage ('AppendFriendlyNames = '  + BoolToStr(AppendFriendlyNames,'True','False')); //Must show FALSE if it set to FALSE by the IDE
  18. end;  
« Last Edit: October 14, 2025, 12:41:31 pm by CM630 »
Лазар 4,2 32 bit (sometimes 64 bit); FPC3,2,2

jamie

  • Hero Member
  • *****
  • Posts: 7323
Re: Issue with custom controls
« Reply #1 on: October 13, 2025, 04:26:21 pm »
I believe you need to override the "Loaded" method which gets called when all the goodies are loaded.!

Jamie
The only true wisdom is knowing you know nothing

CM630

  • Hero Member
  • *****
  • Posts: 1527
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: Issue with custom controls
« Reply #2 on: October 13, 2025, 04:38:43 pm »
Thanks, it seems to work:

Code: Pascal  [Select][+][-]
  1. ...
  2. private
  3.       procedure LoadedAll ; override;
  4. ...
  5. procedure TSerialSelector.LoadedAll ;
  6. begin
  7.   inherited;
  8.   ShowMessage ('AppendFriendlyNames = '  + BoolToStr(AppendFriendlyNames,'True','False'));
  9. end;    


EDIT: All of a sudden .LoadedAll stopped triggering, so I use .Loaded now.
« Last Edit: October 23, 2025, 10:24:59 pm by CM630 »
Лазар 4,2 32 bit (sometimes 64 bit); FPC3,2,2

 

TinyPortal © 2005-2018