FireMonkey Component Execution Error -


i tried create simple component(tgraph) using firemonkey platform (xe7). first of create 2 new classes: 1) tgraph (anchestor type tlayout); 2) tmyplot1d(anchestor type tpanel); saved 2 units , created package called 'mypackage'. compiled , installed in "samples" page. opened new firemonkey project , drag , drop tgraph instance in form. works well. @ designtime,i can see component defined, , relevant units visible main unit. relevant code in following:

first class

unit umyplot;  interface   uses  system.sysutils, system.classes, fmx.types,   fmx.controls, fmx.stdctrls;   type  tmyplot1d = class(tpanel)  private   { private declarations }  protected   { protected declarations }  public   { public declarations }  published   { published declarations }  end;   procedure register;   implementation   procedure register;  begin   registercomponents('samples', [tmyplot1d]);  end;   end. 

second class

unit umygraph;  interface  uses  system.sysutils, system.classes, fmx.types, fmx.controls, fmx.layouts,        umyplot;  type   tmygraph = class(tlayout)   private     plot : tmyplot1d;   public     constructor create(aowner:tcomponent); override;   end;   procedure register;  implementation   procedure register;   begin    registercomponents('samples', [tmygraph]);   end;   constructor tmygraph.create(aowner: tcomponent);   begin    inherited;    plot := tmyplot1d.create(self);    plot.parent := self;  end;   end. 

the problem shown when try run application. got following error: "exception eclassnotfound in module project1.exe @ 000a51fa. class tmyplot1d not found". failed function seems application.realcreateforms.

if drag , drop tmyplot1d instance, works (of course) both in designtime , in runtime!

any ideas?

thanks in advance

in tmygraph.create creating child object, plot. behaviour happens @ both design time , @ runtime.

at runtime there's no problem, problem occurring because when save design time form children of component streamed out fmx file.

when run app streams form in , attempts stream in tmygraph , tmyplot1d child object created @ design time, fails. if succeeded have problem because have both tmyplot1d created @ design time , 1 created @ run time.

you can solve setting stored := false children create @ design time, create method this:

constructor tmygraph.create(aowner: tcomponent); begin   inherited;   plot := tmyplot1d.create(self);   plot.parent := self;   plot.stored := false; end; 

now come reason why class if failing read in streaming system. in fmx need call registerfmxclasses (classes unit) enable class streamed form. need put in initialization section @ end of units (before final end.), e.g.:

initialization   registerfmxclasses([tmygraph]); end. 

Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -