Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2015-03

ComponentList OnClassSelected

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Sandro Cumerlato

Hello,
attached patch brings to front the designer form when a component is selected from the ComponentList.

Please review it and apply if OK.

Sandro Cumerlato
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20150318/703dea13/attachment.html> -------------- next part --------------
Index: ide/componentlist.pas
=================================================================== --- ide/componentlist.pas (revisione 48409)
+++ ide/componentlist.pas (copia locale)
@@ -34,7 +34,7 @@
uses
Classes, SysUtils, LCLType, Forms, Controls, Graphics, StdCtrls, ExtCtrls, ComCtrls, ButtonPanel, Menus, LazarusIDEStrConsts, ComponentReg, PackageDefs,
- IDEImagesIntf, TreeFilterEdit, FormEditingIntf;
+ IDEImagesIntf, TreeFilterEdit, FormEditingIntf, ComponentPalette;

 type
@@ -443,6 +443,8 @@
     IDEComponentPalette.Selected := AComponent;
     FKeepSelected := True;
     Close;
+    if Assigned(TComponentPalette(IDEComponentPalette).OnClassSelected) then
+      TComponentPalette(IDEComponentPalette).OnClassSelected(Self);
   end;
 end;

Reply by email

Juha Manninen
to Sandro Cumerlato
Sandro Cumerlato wrote
attached patch brings to front the designer form when a component is selected from the ComponentList. Please review it and apply if OK.

Sorry, this implementation must be rejected. The idea is good but it must use the public interface in ComponentReg.
If the current interface is not enough, it can be extended. I just did a big refactoring for separating the interface (TBaseComponentPage, TBaseComponentPalette etc.) from the GUI implementations.
It is not ready and I am not sure if it even is worth the effort to cut the inheritance completely. Now anyway there are no references to GUI controls in the interface, but all relevant non-GUI stuff is there, including property Selected: TRegisteredComponent. All GUI controls are in the implementing classes.

My plan was to make a "PaletteViewer" interface which would initially be implemented by TComponentPalette and TComponentList. Let's see if it happens ...

If you modify / refactor your patch and break the TComponentPalette dependency, I will be happy to apply it.

Regards,
Juha

Reply by email