Sign in Join

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

Mailing lists / lazarus / 2003-01

Create component editor : questions

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

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

olivier Guilbaud

Hello

I test of create an TMenu editor (property Items of TMenu and TPopupMenu) but i have some problems : howto select the new TMenuItem in the object inspector ?

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 (?)

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

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

Thanks
Olivier

Reply by email

Mattias Gaertner
to olivier Guilbaud
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:

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

The line

  Hook.ComponentAdded(aItem,true);

should do this already.

Show quoted text 19 lines
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

Reply by email