As Todd said. Also. If you are making custom controls make sure you use registerclass to add them to the internal class list for lookup<span></span><br><br>On Friday, July 13, 2012, Todd Martin wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
b := TComponentClass(FindClass('TButton')).Create(nil);<br>
propinfo := GetPropInfo(b.classinfo,'left');<br>
SetOrdProp(b,propinfo,100);<br>
<br>
> I want to create an object at runtime given a string with the object type. Is this possible or do I need to do a whole pile of if then else's? There is a limited number of different objects that need to be created. I then want to access the created objects properties by name and assign methods.<br>
><br>
> This is not for oleobjects, but VCL controls.<br>
><br>
> i.e.<br>
> b := CreateObject('TButton') ;<br>
> b.GetField('left') := 100 ;<br>
> ...<br>
><br>
> Help on any of these would be appreciated.<br>
><br>
> Cheers,<br>
> Dave.<br>
><br>
><br>
> _______________________________________________<br>
> NZ Borland Developers Group - Delphi mailing list<br>
> Post: <a href="javascript:;" onclick="_e(event, 'cvml', '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="javascript:;" onclick="_e(event, 'cvml', 'delphi-request@listserver.123.net.nz')">delphi-request@listserver.123.net.nz</a> with Subject: unsubscribe<br>
<br>
<br>
_______________________________________________<br>
NZ Borland Developers Group - Delphi mailing list<br>
Post: <a href="javascript:;" onclick="_e(event, 'cvml', '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="javascript:;" onclick="_e(event, 'cvml', 'delphi-request@listserver.123.net.nz')">delphi-request@listserver.123.net.nz</a> with Subject: unsubscribe<br>
</blockquote><br><br>-- <br>Sent from Gmail Mobile<br>