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

Re: Access Canvas from Modeless Dialog?

Phil Moors wrote:

> Hello,
> I need to send text to the canvas when a button is pressed on a modeless dialog
> box. I have the canvas and the dialog box all set, but can't call DrawText()
> from the dialog box. How can I make the dialog aware of the canvas functions?

Hy Phil,
one of the persons who asked this question to Mr. Wampler recently was me. So, to
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
"pParent->DrawText (.....);"
This is quite simple and worked fine for me. Hope that it works also fine for you.
      Matthias Klingel
      Institut für Siedlungswasserwirtschaft
      Universität Karlsruhe
      Adenauerring 20
      D-76128 Karlsruhe
      Tel ++49/721/608-6657
      Fax ++49/721/607-151

Reply to: