[Gambas-user] Get the object of a component by name.

Matias De lellis mati86_dl at ...1877...
Wed Feb 24 15:05:54 CET 2016


Hi

El Martes, 23 de febrero, 2016 21:00:06, Tobias Boege <taboege at ...626...> escribió:
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.


Then I found this explanation but not want to do it static... 

> > >  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.


Thanks you!. 
It's a very interesting way, but then dismiss it because restrict me in the construction of graphical user interface.. Or to make rich user interfaces, would have to write many new controls.. I think not worth it .. :(


Attach a "sketch" of what I intend to do..

Lack entire deployment serial port, and simulated events using a timer to Raise events. To continue the development, momentarily, I do dependency injection (See FTest.class:12 and DigitalSwitch.class:39).

This is exactly what I wanted to avoid, but at the moment allow me to continue.. Of course, for the user, it is a single line of code, but want to do it editable graphically.. 


Regards,
Matias
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Firmata-0.2.1.tar.gz
Type: application/gzipped-tar
Size: 16014 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20160224/568d320b/attachment.bin>


More information about the User mailing list