[V4RB] beginners question store global objectRefs
Ruslan Zasukhin
sunshine at public.kherson.ua
Fri Jun 24 23:04:15 CDT 2005
On 6/24/05 11:46 AM, "peter salomon" <peter.salomon at gmx.net> wrote:
> 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.
YES, and because it is public you can access it from other places
window.mDB
> 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.
Sounds like you USE it before you have initialize it.
> hm - ok, so i made a function in which i transport the objectreference
> to the new window, something like:
NO NEED
> 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
>
> _______________________________________________
> Valentina mailing list
> Valentina at lists.macserve.net
> http://lists.macserve.net/mailman/listinfo/valentina
--
Best regards,
Ruslan Zasukhin
VP Engineering and New Technology
Paradigma Software, Inc
Valentina - Joining Worlds of Information
http://www.paradigmasoft.com
[I feel the need: the need for speed]
More information about the Valentina
mailing list