ide - delphi - Creating custom frame with new event -


i'm working on delphi xe2.
what need:
need myframe class frame without visible components, new event visible in object inspector. event inform form (on placed myframe object), f.e. datas on frame fullfilled.

what have:
based on this post , tondrej's answer, , that hint, ba shows, xe2 need replace

delphivclide := getmodulehandle('delphivclide160.bpl'); 

with this:

delphivclide := getmodulehandle('vcldesigner160.bpl'); 

i have code new frame:

unit myframe; interface uses   system.classes, vcl.forms; type   tmyframe = class(tframe)   private   protected     fonfilleddata : tnotifyevent;   public   published     property onfilleddata : tnotifyevent read fonfilleddata write fonfilleddata;   end; implementation end. 

and code registration unit:

unit myframereg; interface procedure register;  implementation uses windows, designintf, dialogs, wframe;  procedure register; var   delphivclide: thandle;   tframemodule: tcustommoduleclass; begin   delphivclide := getmodulehandle('vcldesigner160.bpl');   if delphivclide <> 0   begin     tframemodule := getprocaddress(delphivclide, '@vclformcontainer@tframemodule@');     if assigned(tframemodule)     begin       showmessage('i''m here');       registercustommodule(tmyframe, tframemodule);     end;   end; end; end. 

when i'll build package, have message i'm here, supossed, myframe registered.

what problem:
problem is, dosn't work end.
when choose new vcl application, , want create myframe choosing file -> new -> other -> delphi projects -> myframe apears strange window showed below.
when select directory there , click ok button, new delphi project closed , package project opened.

the window

i'll glad, if can advise me, i've done wrong.

a. frame class registration

there no need in "hacky way"

uses ...   dmform,   vclformcontainer, ...  procedure register; begin ...   registercustommodule(tyourframeclass, tframemodule);   // frames   registercustommodule(tyourmoduleclass, tdatamodulecustommodule);   // data modules ... end; 

there way around add frames too

type   tnestablewincontrolcustommodule = class (twincontrolcustommodule)   public     function nestable: boolean; override;   end;  function tnestablewincontrolcustommodule.nestable: boolean; begin   result := true; end; 

+

  registercustommodule(tyourframeclass, tnestablewincontrolcustommodule); 

names of units (tested in xe7):

tcustommodule => designeditors

tdatamodulecustommodule => dmform (designide.dcp)

twincontrolcustommodule => wctlform (designide.dcp)

tframemodule => vclformcontainer (vcldesigner.dcp)

i suppose firemonkey should possible in similar way (find fmxdesigner.dcp & check inside in notepad++)

b. use inside "new..." wizard need register wizard class. if don't have time write wizard class create new frame , replace parent class name manually , add appropriate unit "uses" list. that's all

ps. in older delphi versions there tdatamoduledesignercustommodule metaclass instead of tdatamodulecustommodule in unit dmdesigner

pps. other existing metaclass names:

tcustomformcustommodule

tidesourcemodulecustommodule


Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -