I am not sure whether my code is readable, but anyway - the problem
is the compiler's complaint of the lack of an LVAlue on the line marked with
asterisks ******* below.
The code is attempting to set up a "live" display of the time on a
dialog (SprTimingEditor). In the particular piece of code cited I am
attempting to get at a TransferStruct member (TimeStruct) in the TApplication
object so that I can set it's values. And then (using tdSetData) set the
dialog values. In my view I have a valid pointer to the current application
instance (theApp) and TimeDate is a valid member of TMyApp which should be
automatically constructed when it's class (TMyApp) is constructed -Sooo -
theApp->TimeDate.sec should be a valid LValue. |-(
static TMyApp* theApp = 0;
struct TimeStruct {
TimeStruct();
char day[3];
char month[3];
char year[5];
char hour[3];
char min[3];
char sec[3];
};
TimeStruct::TimeStruct()
{
year[0] = 0;
day[0] = 0;
month[0] = 0;
hour[0] = 0;
min[0] = 0;
sec[0] = 0;
}
class TMyApp : public TApplication {
public:
TMyApp();
TMyApp* App;
TimeStruct TimeDate;
protected:
TMyApp* GetAppPtr(){return theApp;}
};
TMyApp::TMyApp()
{
memset(&TimeDate, 0, sizeof TimeDate);
}
void TMyApp::CmTiming()
{
SprTimingEditor(GetMainWindow(), DIALOG_1, TimeDate,
etAppPtr()).Execute();
}
SprTimingEditor::SprTimingEditor(TWindow* parent, TResID id,
TimeStruct& TimeDate, TMyApp* AppPtr):
TDialog(parent, id), TWindow (parent) {
...
continueTime = 1;
TransferBuffer = (void far*)&TimeDate;
}
void
SprTimingEditor::SetUpWindow()
{
TDialog::SetUpWindow();
SetTime();
}
void
SprTimingEditor::SetTime()
{
while (continueTime == 1)
{
TTime* TimePtr = new TTime();
******* theApp->TimeDate.sec = (int)TimePtr->Second();*** LValue needed
***
TransferData(tdSetData);
delete TimePtr; //I think this deletes the TTime object
}
}
int OwlMain(int, char* [])
{
TMyApp * App = new TMyApp;
int result;
theApp = App;
result = App->Run();
return result;
}
---
---------------
* Origin: Melbourne PC User Group BBS (3:632/309)
|