[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Access Canvas from Modeless Dialog?



Mathias has the solution I would use, though I would modify it slightly to make it more const-correct:

class MyDialog : public vDialog
{
public:
    MyDialog (
        const vBaseWindow* baseWindow, 
        const char* title, 
        const MyCmdWindow* pParent)
        : cmdWin (pParent),
          vDialog (baseWindow, 0, title)
    {
        // constructor code here
    }

private:
    const MyCmdWindow* cmdWin;
};



cheers... Tom Hilinski


----- Original Message ----- 
From: Matthias Klingel <gh31@mailhost.rz.uni-karlsruhe.de>
To: <vgui-discuss@other.debian.org>
Sent: Friday, May 28, 1999 2:49 AM
Subject: Re: Access Canvas from Modeless Dialog?


| make the answer more precisely: you have to include in the class you derive from
| vDialog (e.g. MyDialog) a pointer to MyCmdWindow (derived from vCmdWindow) and
| initialize this pointer in the constructor of MyDialog. The constructor head line
| would then look like this:
| "MyDialog (vBaseWindow* BaseWindow, char* Title, MyCmdWindow* _pParent);"
| Inside the constructor there must be a line like
| "pParent = _pParent;"
| where pParent is the new pointer mentioned above. Surely, in the constructor of
| MyCmdWindow, you now write like
| "SomeDialog = new MyDialog (this, "a title", this);"
| And if you want to send a message from your dialog to the command window, you do it
| like
| "pParent->DrawText (.....);"




Reply to: