How to call a metode in an object at an upper level ?
Hello,
I try to creat an object for make easy input with the 'TV_Text.spin' object and keyboard with the gestion of a cursor like the input in html.
For that, i created an object caled 'input'. It is 'instancieted' in the 'TV_TEXT' object. The 'input' object need to call some metode in the 'TV_TEXT' object but the 'input' object can not see the TV_TEXT's metodes because it is 'above' to it. Is that possible ?
Thank-You
dro
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
in medio virtus
Post Edited (inservi) : 1/14/2007 8:34:13 AM GMT
I try to creat an object for make easy input with the 'TV_Text.spin' object and keyboard with the gestion of a cursor like the input in html.
For that, i created an object caled 'input'. It is 'instancieted' in the 'TV_TEXT' object. The 'input' object need to call some metode in the 'TV_TEXT' object but the 'input' object can not see the TV_TEXT's metodes because it is 'above' to it. Is that possible ?
Thank-You
dro
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
in medio virtus
Post Edited (inservi) : 1/14/2007 8:34:13 AM GMT
Comments
Before taking this route, though, you might want to reexamine the structure of your code to see if you can do what you want in a way that's supported in Spin.
-Phil
I understant that is not a good idea. I'm just disappointing because in this case, i can not make a clean object easy to share. I will simply include the methodes in the 'TV_TEXT' object.
As i'd like to contribute to the programers comunity, it is not for this time.
Thank-you for your help.
(sorry for my bad English, I speak French)
dro
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
in medio virtus
object, anywhere. I am uploading an example use here.
The Main class is an example of use. The Singleton class is where you put all the objects you
want to share globally (like keyboard, or tv_text, or whatnot). The Utility class is where you
put stubs that invoke the methods you want to access on the objects. Utility is then
included as a subobject everywhere, but because it has no var space you really only get one
copy and no additional memory is needed.
You can also use this to do things like standard out/standard in redirection; so for instance if
you have tv_text for normal I/O, you can redirect that I/O to my SD writing routines very
easily. Also, by putting all the I/O stuff in Singleton with links in Utility, you can easily make a
program that adapts itself to whatever setup people may have (for example, Hydra, or demo
board; serial LCD I/O vs tv_text vs FullDuplex, etc.)
It's also a simple example of callbacks (although for general callback use the connect()
function needs to be moved to Utility so it can be invoked anywhere).
Enjoy! It rewrites spin opcodes but it does so minimally and pretty simply.
I'l try this quickly. It look to be great!
dro
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
in medio virtus