[V4RB] beginners question store global objectRefs
peter salomon
peter.salomon at gmx.net
Fri Jun 24 10:46:56 CDT 2005
Hi all,
as i come from Lingo i have not well understood how RB handles global
variables. I know that this one is more a RB question but maybe
concerning V4rb there might be a common way..
I´ve tested the tutorial file where the databaseobject was created by
caling "new"
Then it´s stored within a property which is set to public.
ok so far, i can use it within THIS window.
But now i want to implement other functions within another new window,
e.g. a preferencepanel.
when i try to use the databaseobject from main windows property i get a
nilobjectexception.
hm - ok, so i made a function in which i transport the objectreference
to the new window, something like:
prefsWindow.prepare(databaseRef)
method prepare is defined as
prepare(inDB As VDatabase)
// filling properties
mtblA = inDB.table("tblA")
mtblB = inDB.table("tblB")
.
me.show()
.
end
i have created again some properties for this window with my tableRef
names:
inDB As VDatabase
mtblA As VTable
mtblB As VTable...
so i thought i would have created tablereferences and made them public
for all other methods.
But when i want to use them e always get a nilobjectexception on my
tablereferences.
what is wrong here? I have thought that this must work...
next step could be to define methods in main window and just call them
from the new window but interaction between them seems to be ugly to me:
from newWindow, e.g. pushbutton action:
call mainWindow.methodA()
and method in mainwindow:
methodA()
// some dbqueries
.
.
call newWindow.methodB(resultFromMainWin)
end
So - which is the common way to use several windows using a valentinaDB?
thanks for help,
peter
More information about the Valentina
mailing list