They dont need to. DFM use read component and you pass an existing instance.. ie TFORM as the top layer. it then uses the runtime information of the instance to stream the data. ie.. a button on the form as a property has runtime information, but its not registered with GetClass.. the only difference is that you need global lookup. the class info is in memory, just not in the lookup list.<br>
<br>Have fun. <br><br><br><br><div class="gmail_quote">On Mon, Jul 16, 2012 at 5:45 PM, David O&#39;Brien <span dir="ltr">&lt;<a href="mailto:Dave@iccs.co.nz" target="_blank">Dave@iccs.co.nz</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div link="blue" vlink="purple" lang="EN-NZ"><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Thanks, Oh well... I understand, but I don’t really know what classes will be used, guess I’ll just have to register everything </span><span style="font-size:11.0pt;font-family:Wingdings;color:#1f497d">L</span><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">. I would have thought the standard VCL controls would have been sorted though...<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;" lang="EN-US">From:</span></b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;" lang="EN-US"> <a href="mailto:delphi-bounces@listserver.123.net.nz" target="_blank">delphi-bounces@listserver.123.net.nz</a> [mailto:<a href="mailto:delphi-bounces@listserver.123.net.nz" target="_blank">delphi-bounces@listserver.123.net.nz</a>] <b>On Behalf Of </b>Kyley Harris<br>
<b>Sent:</b> Monday, 16 July 2012 5:35 p.m.</span></p><div><div class="h5"><br><b>To:</b> NZ Borland Developers Group - Delphi List<br><b>Subject:</b> Re: [DUG] Creating an object at run time.<u></u><u></u></div></div><p>
</p><div><div class="h5"><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal" style="margin-bottom:12.0pt">David,<br><br>a basic test on a blank form shows that the following code doesn&#39;t work unless registerclass is called first (of course you&#39;d only do this 1 time).<br>
<br>clearly they are not registering these classes by default for streaming. you will probably find that the Delphi IDE registers them all internally for DFM creation, but they haven&#39;t done it by default for end runtime code.<br>
<br>begin<br>  RegisterClass(TButton);<br>  with TComponentClass(FindClass(&#39;TButton&#39;)).Create(self)  as tbutton    do<br>  begin<br>     top := 10;<br>     left := 10;<br>     caption := &#39;hello&#39;;<br>     width := 100;<br>
    parent := self;<br>  end;<u></u><u></u></p><div><p class="MsoNormal">On Mon, Jul 16, 2012 at 12:41 PM, David O&#39;Brien &lt;<a href="mailto:Dave@iccs.co.nz" target="_blank">Dave@iccs.co.nz</a>&gt; wrote:<u></u><u></u></p>
<p class="MsoNormal">Very frustrating, I&#39;m getting &quot;Class TButton not Found&quot; with the below<br>code. Everything in the uses clause is correct: I have a Tbutton on the<br>form at design time. The form is in a .bpl if that will make a<br>
difference?<br><br>// Simplified...<br>Uses ..., StdCtrls, ...<br>Var<br>  o: TComponent ;<br>  ot: String ;<br>begin<br>      ot := &#39;TButton&#39; ;<br>      o := TComponentClass(FindClass(ot)).Create(nil); &lt;--- Class<br>
TButton Not Found<br>end ;<u></u><u></u></p><div><p class="MsoNormal"><br>-----Original Message-----<br>From: <a href="mailto:delphi-bounces@listserver.123.net.nz" target="_blank">delphi-bounces@listserver.123.net.nz</a><br>
[mailto:<a href="mailto:delphi-bounces@listserver.123.net.nz" target="_blank">delphi-bounces@listserver.123.net.nz</a>] On Behalf Of Todd Martin<br>Sent: Friday, 13 July 2012 4:27 p.m.<u></u><u></u></p></div><div><p class="MsoNormal" style="margin-bottom:12.0pt">
To: NZ Borland Developers Group - Delphi List<br>Subject: Re: [DUG] Creating an object at run time.<u></u><u></u></p></div><div><div><p class="MsoNormal">b := TComponentClass(FindClass(&#39;TButton&#39;)).Create(nil);<br>
propinfo := GetPropInfo(b.classinfo,&#39;left&#39;); SetOrdProp(b,propinfo,100);<br><br>&gt; I want to create an object at runtime given a string with the object<br>type. Is this possible or do I need to do a whole pile of if then<br>
else&#39;s? There is a limited number of different objects that need to be<br>created. I then want to access the created objects properties by name<br>and assign methods.<br>&gt;<br>&gt; This is not for oleobjects, but VCL controls.<br>
&gt;<br>&gt; i.e.<br>&gt; b := CreateObject(&#39;TButton&#39;) ;<br>&gt; b.GetField(&#39;left&#39;) := 100 ;<br>&gt; ...<br>&gt;<br>&gt; Help on any of these would be appreciated.<br>&gt;<br>&gt; Cheers,<br>&gt; Dave.<br>
&gt;<br>&gt;<br>&gt; _______________________________________________<br>&gt; NZ Borland Developers Group - Delphi mailing list<br>&gt; Post: <a href="mailto:delphi@listserver.123.net.nz" target="_blank">delphi@listserver.123.net.nz</a><br>
&gt; Admin: <a href="http://delphi.org.nz/mailman/listinfo/delphi" target="_blank">http://delphi.org.nz/mailman/listinfo/delphi</a><br>&gt; Unsubscribe: send an email to <a href="mailto:delphi-request@listserver.123.net.nz" target="_blank">delphi-request@listserver.123.net.nz</a><br>
&gt; with Subject: unsubscribe<br><br><br>_______________________________________________<br>NZ Borland Developers Group - Delphi mailing list<br>Post: <a href="mailto:delphi@listserver.123.net.nz" target="_blank">delphi@listserver.123.net.nz</a><br>
Admin: <a href="http://delphi.org.nz/mailman/listinfo/delphi" target="_blank">http://delphi.org.nz/mailman/listinfo/delphi</a><br>Unsubscribe: send an email to <a href="mailto:delphi-request@listserver.123.net.nz" target="_blank">delphi-request@listserver.123.net.nz</a> with<br>
Subject: unsubscribe<br><br>_______________________________________________<br>NZ Borland Developers Group - Delphi mailing list<br>Post: <a href="mailto:delphi@listserver.123.net.nz" target="_blank">delphi@listserver.123.net.nz</a><br>
Admin: <a href="http://delphi.org.nz/mailman/listinfo/delphi" target="_blank">http://delphi.org.nz/mailman/listinfo/delphi</a><br>Unsubscribe: send an email to <a href="mailto:delphi-request@listserver.123.net.nz" target="_blank">delphi-request@listserver.123.net.nz</a> with Subject: unsubscribe<u></u><u></u></p>
</div></div></div><p class="MsoNormal"><br><br clear="all"><br>-- <br>Kyley Harris<br>Harris Software<br>+64-21-671-821<u></u><u></u></p></div></div></div></div><br>_______________________________________________<br>
NZ Borland Developers Group - Delphi mailing list<br>
Post: <a href="mailto:delphi@listserver.123.net.nz">delphi@listserver.123.net.nz</a><br>
Admin: <a href="http://delphi.org.nz/mailman/listinfo/delphi" target="_blank">http://delphi.org.nz/mailman/listinfo/delphi</a><br>
Unsubscribe: send an email to <a href="mailto:delphi-request@listserver.123.net.nz">delphi-request@listserver.123.net.nz</a> with Subject: unsubscribe<br></blockquote></div><br><br clear="all"><br>-- <br>Kyley Harris<br>
Harris Software<br>+64-21-671-821<br>