Page 1 of 1

adding objects programmatically

PostPosted: Sun Feb 13, 2011 11:22 am
by Boudewijn
it would be nice if I could add objects programmatically.
The basic idea is this:
I create a textbox, create some custom properties in that and save that in a library:
on a form I can then code something like:
forms['thisform'].Newobject("ObjectName","Library","libraryObject",[param1], [param2], [paramnn])
assuming ObjectName would be "mytextbox" I could then later on do something like
forms['thisform'].mytextbox.top = 123
forms['thisform'].mytextbox.left = 456
forms['thisform'].mytextbox.text = "Just created textbox"

Re: adding objects programmatically

PostPosted: Sun Feb 13, 2011 12:24 pm
by ROCLASI
Hi Boudewijn,

You already can :)
Take a look at the SolutionModel node in the Solution Explorer.

Hope this helps.

Re: adding objects programmatically

PostPosted: Sun Feb 13, 2011 11:57 pm
by Boudewijn
Are you saying I can create base classes of any object type (textbox, label, combos, lists, buttons etc etc) and use those in my forms?
Because THAT is what I am talking about here.
OOP as OOP is meant to be.
If that is really true then I wonder why this waas not shown in the training I did in september last year.
BY ALL MEANS! Show me how to achieve that.

Next URGENT Q is, "is there something like field mapping?", this is, Field type mapped to a specific class in a library! THAT would be fantastic!

Boudewijn "spoiled rotten" VFP developer.

Re: adding objects programmatically

PostPosted: Mon Feb 14, 2011 11:32 am
by jcompagner
what you want can't be done by servoy base classes, Servoy just provides you some base classes, you can't subclass those as real classes, for that we have our templates, where you can pre configure or combine components that you then can reuse on forms.

If you really want to do more you have to work with beans.