[Lazarus] Detect that component selected in OI.
Vojtěch Čihák
vojtech.cihak at atlas.cz
Sun May 22 14:13:37 CEST 2016
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 <lazarus at kluug.net>
> Komu: Lazarus mailing list <lazarus at 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 at lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus <http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20160522/5f2a9d11/attachment-0003.html>
More information about the Lazarus
mailing list