On Tue, 23 Feb 2016, Matias De lellis wrote:
> > So, what I read out of your mail is that you have one object Firmata1 which
> > has a certain configuration. You now want to add controls dynamically to the
> > Form which should inherit Firmata1's configuration by obtaining a reference
> > to the Firmata1 object.
> 
> 
> Not completely dynamic.. After completing write the controls the idea is just 
> change the list of properties of the controls placed on the form. (Not 
> writing a single line of code more after design forms)
> 
> >  2. Can't you pass the Firmata1 object to the constructors of the controls?
> 
> Would be ideal, but I do not see how. Justly my idea was to add a property 
> representing the instance name, and get the instance itself from that. 
> http://gambaswiki.org/wiki/comp/gb/class/instance seems ideal but not work 
> here..
> 

Class["Name"].Instance returns the auto-instance of an auto-creatable (i.e.
Create Static[0]) class. Unless you class is Create Static, this will not
give you any object at all.

> >  3. (A refinement of 2.) Make the Firmata class a Container object and
> >     create the controls inside the container Firmata1. This way, the
> >     controls can access their parent Firmata1 and its configuration
> >     directly. This is how the DataSource control from gb.db.form works,
> >     if you are familiar with that.
> 
> 
> I will investigate this option..
> 

If you don't need to create controls at runtime, i.e. the layout of your
form is complete at compile time, then this would be the way to go. I attach
a small project which shows how it's done.

Regards,
Tobi

[0] http://gambaswiki.org/wiki/lang/createstatic

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk

Attachment: container-config-0.0.1.tar.gz
Description: Binary data

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
Gambas-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to