[lazarus] Create component editor : questions

Mattias Gaertner nc-gaertnma at netcologne.de
Thu Jan 23 11:30:47 EST 2003


On Wed, 22 Jan 2003 23:46:57 +0100
olivier Guilbaud <golivier at free.fr> wrote:

> Hello
> 
> I test of create an TMenu editor (property Items of TMenu and TPopupMenu) 

Martin Patik is already working on that. Maybe you can help him:
Martin.Patik at rg.siemens.cz


> but i have some problems : howto select the new TMenuItem in the object
> inspector ?

The line
  Hook.ComponentAdded(aItem,true);
should do this already.


> my code is 
> 
> procedure TMenuComponentEditor.AddNewItemToDesigner(aItem : TMenuItem);
> var
>   Hook: TPropertyEditorHook;
>   NewName: string;
> begin
>   Hook:=nil;
>   if not GetHook(Hook) then exit;
>   NewName:=GetDesigner.CreateUniqueComponentName(aItem.ClassName);
>   aItem.Caption:=NewName;
>   aItem.Name:=NewName;
> 
>   Hook.ComponentAdded(aItem,true);
>   GetDesigner.Modified;
> end;
> 
> i have an AccessViolation at " Hook.ComponentAdded(aItem,true);" and Hook
> is assigned (?)

Can you send the source?


> Other problem, the Object inspector is locked because i showModal the
> editor ?? then how to make. if somebody had a idee or an end of source
> code with an example

Under Delphi the menu editor is not modal. I think we should do it the same.
Define a global var for the menu editor, to make sure, there is always only
one instance.


> I go can be to make another editor (simpler) to advance more quickly. 
> TTreeView, TListView, TToolBar ...

:)

Mattias






More information about the Lazarus mailing list