The static myClass in manager.cpp creates an instance which is available
only in the module. The extern myClass in dialog.cpp would therefore note be
referencing the same instance which would explain why your variables do not
have the values you expect.
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Nick
Torenvliet
Sent: Saturday, June 24, 2000 09:23
To: Palm Developer Forum
Subject: FrmDoDialog() and Global variables
I have a little problem I can't seem to iron out,
I have a class defined in
myClass.cpp and myClass.h
I have another file manager.cpp in which an object of the class is
initiated( the
object is declared at the top of the file).
static myClass myClassInst
Inside of a function in the manager.cpp file a FrmDoDialog(frmP) is called
like so
myClassInst.setup_the_data();
myClassInst.CheckMyClass();
FrmSetEventHandler(MyDialogEventHandler,etc.);
FrmDoDialog(frmP);
myClassInst.CheckMyClass();
The event handler for the dailog is in another file called dialog.cpp and
all the
buttons and such work properly so the basic dialog structure is working.
However
I also want the Dialog event handler to access data members(specifically I
have a
DmOpenRef stored there) in myClassInst so I declare(at the top of
dialog.cpp)
extern myClass myClassInst;
And I try to do some database operations from inside MyDialogEventHandler,
using the
database handles stored in myClassInst.
Now here is the problem before and after the FrmDoDialog() I can use
CheckMyClass()
or a debugger variable watch and everything is as it should be, the database
handles
are all set up and data access works. However from inside the dialog event
handler
I can see an instance of myClass called myClassInst(using the debugger
watch) but all
the variables which look good before and after the FrmDoDialog() call are
now set to zero
and any calls I make to the database results in an error.
This is a problem as I cannot work with my data inside to Frm.
Thanks for your time.
Nick Torenvliet
--
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/tech/support/forums/
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/