Thank you, Ondrej, it works and it is pretty easy.
 
Summary:
 
Let's say you have class TMyPageControl which consists of TMyTabSheet classes 
(TWinControls).
 
uses ... PropEdits, ...;
 
TMyTabSheet = class(TWinControl)
  ...
  protected
    procedure HookSelection(const ASelection: TPersistentSelectionList);
  ...
  end;     
 
constructor TMyTabSheet.Create(TheOwner: TComponent);
begin
  ...
  GlobalDesignHook.AddHandlerSetSelection(@HookSelection);
end;  
 
procedure TMyTabSheet.HookSelection(const ASelection: TPersistentSelectionList);
begin
  if assigned(FMyPageControl) and (ASelection.IndexOf(self)>=0) then
    FMyPageControl.TabIndex:= FMyPageControl.Pages.IndexOf(self);
end;   
 
______________________________________________________________
Od: Ondrej Pokorny <laza...@kluug.net>
Komu: Lazarus mailing list <lazarus@lists.lazarus.freepascal.org>
Datum: 22.05.2016 12:56
Předmět: Re: [Lazarus] Detect that component selected in OI.


Instead, do what Howard suggested (although not directly): In your component's design-time package, register a SetSelection hook ("GlobalDesignHook.AddHandlerSetSelection(@OnComponentSelection);"). Then in OnComponentSelection you check if your own component is in the new selection and do whatever you want.

Ondrej

--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus 
<http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus>

--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to