[Lazarus] Component editors and related

Werner Pamler werner.pamler at freenet.de
Thu Apr 26 14:33:15 CEST 2018


Am 25.04.2018 um 22:07 schrieb Werner Pamler via Lazarus:
> Am 25.04.2018 um 20:40 schrieb Vojtěch Čihák via Lazarus:
>>
>> ad 1: I never tried two level collection. Are they all published 
>> (both collections and their items)?
>>
>
> Yes. And both collections are accessible in the object inspector: The 
> JvOutlookBar has a property "Pages", the ellipsis button next to it 
> opens the usual collection property editor which can be used to add, 
> delete or rearrange pages. And when one of the pages is selected the 
> object inspector displays the property "Buttons", again with an 
> ellipsis button to open another collection property editor, now for 
> the buttons. This part is working out of the box. The problem is the 
> component tree which only shows the page nodes but no button nodes.

I am getting the impression that this is a bug of the component tree. 
The listed page items inherit from TCollectionItem, not from TComponent. 
The component tree somehow must be instructed to look for another 
collection within each page colletionItem.

>> ad 2: You can do (in your component editor) something like:
>>
>> var aHook: TPropertyEditorHook;
>>
>> begin
>>
>>   ...
>>
>>   aHook:=nil;
>>
>>       if not GetHook(aHook) then exit;
>>
>>   ...
>>
>>   //add or insert:
>>
>> AddedItem:=aComponent.Columns.Add;
>>
>> aHook.PersistentAdded(AddedItem, True);  //this notifies component tree
>>
>> aHook.SelectOnlyThis(AddedItem);   //this selects added object
>>
>>   //deleting
>>
>>    DeletedItem:=aComponent.Columns[aIndex];
>>
>>  aHook.DeletePersistent(TPersistent(DeletedItem)); //this notifies 
>> component tree
>>
>
> This is for notification of the component tree by the component editor 
> and this code is already there and working. What I want is 
> notification of the component editor by the designer if pages or 
> buttons are added while the component editor is open (the component 
> editor is not modal).

I was able to solve this based on code I found in unit 
components/ideintf/fieldseditor. The key point is that handlers for 
GlobalDesignHook events/notifications must be added. BTW, there is a 
"GlobalDesignHook" and a "FDesigner.PropertyEditorHook" - are they the 
same, or: what is the difference?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20180426/edd1ae76/attachment-0001.html>


More information about the Lazarus mailing list