Delphi, Editor for Button, preserve default click in IDE -
xe3 prof, win64.
i created new button component, based on tbutton.
it have special menu in ide, named "set button style".
procedure register; begin registercomponents('scomps', [tsabutton]); registercomponenteditor(tsabutton, tsabuttoneditor); end; procedure tsabuttoneditor.executeverb(index: integer); begin set_style(tsabutton(component)); end; function tsabuttoneditor.getverb(index: integer): string; begin result := 'set button style'; end; function tsabuttoneditor.getverbcount: integer; begin result := 1; end;
the button's have special click in ide - double click on component generates onclick in code.
after installed editor menu, capability lost, because ide calls function, , not original (the default code generating).
how can restore capability in button preserving menu too?
thanks every info!
dd
i guess editor inherited tcomponenteditor ? if , need call default edit function in order generates onclick event of component inside editor executeverb function . note : edit function empty in tcomponenteditor class .. need use idefaulteditor interface call edit function :
first method :
procedure tyoureditor.executeverb(index: integer); var defeditor: idefaulteditor; begin defeditor := tdefaulteditor.create(component, designer); defeditor.edit; case index of 0: // dosomething !! // ... // ... end; //... end;
second method :
you have way : can inherite editor tdefaulteditor class (and not tcomponenteditor) :
tyoureditor = class(tdefaulteditor) ..... procedure tyoureditor.executeverb(index: integer); begin inherited; end;
but if use second method , lose capability (only when double click, other context menu apear normaly ). prefer using first method .
Comments
Post a Comment