Article View: comp.windows.interviews
Article #10Re: canvas nil right after editor opened
From: Bill Poitras
Date: Tue, 27 Oct 1992 22:05
Date: Tue, 27 Oct 1992 22:05
37 lines
1865 bytes
1865 bytes
Mu-Yu Yang (yang@dukas.cs.unc.edu) wrote:
: I am trying to get access to an editor's WindowRep right after the editor is
: opened by Unidraw but have no luck. It fails because the canvas of the
: newly-opened editor is still nil. Take Punidraw for example for the sake of
: simplicity:
:
: Creator creator;
: Unidraw* unidraw = new Unidraw(
: new Catalog(
: "punidraw", &creator
: ), argc, argv, options, properties
: );
:
: Punidraw* punidraw = new Punidraw;
: unidraw->Open(punidraw);
: punidraw->GetCanvas()->window()->rep();
:
: This will blow up since punidraw->GetCanvas() returns nil. Does Anyone know
: how to get the WindowRep or make the canvas non-nil right after the editor
: is opened? Any hint will be very much appreciated.
You could wait until the window is mapped:
unidraw->Open(punidraw);
Event e;
while (punidraw->GetCanvas() != nil) {
Session::instance()->read(e);
e.handle();
}
punidraw->GetCanvas()->window()->rep();
--
+-----------------+-------------------------------+-------------------------+
| Bill Poitras | Molecular Simulations Inc. | Tel (408)522-9229 |
| (bill) | Sunnyvale, CA USA | |
| | FAX (408)732-0831 | bill@msi.com |
+-----------------+-------------------------------+-------------------------+
Technical Details
Message-ID:
<1992Oct27.220531.2639@msi.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!ukma!darwin.sura.net!sgiblab!msi!snoopy!billReferences:
<16743@borg.cs.unc.edu>Show Full Headers
Complete Article Headers
Newsgroups: comp.windows.interviews Path: arc1-ca.pugleaf.net!sparky!uunet!ukma!darwin.sura.net!sgiblab!msi!snoopy!bill From: bill@snoopy (Bill Poitras) Subject: Re: canvas nil right after editor opened Message-ID: <1992Oct27.220531.2639@msi.com> Sender: usenet@msi.com (USENET) Reply-To: bill@msi.com Organization: Molecular Simulations, Inc. X-Newsreader: Tin 1.1 PL5 References: <16743@borg.cs.unc.edu> Date: Tue, 27 Oct 1992 22:05:31 GMT Lines: 38