Article View: comp.windows.interviews
Article #537Re: Transient Window Dialog
From: Mark Linton
Date: Thu, 27 Aug 1992 16:38
Date: Thu, 27 Aug 1992 16:38
71 lines
2706 bytes
2706 bytes
In article <1992Aug21.201755.25251@eng.ufl.edu>, jmc@sioux.eel.ufl.edu (Jim Callahan) writes:
|> I am having problems with using system calls in a InterViews program.
|>I would like to map a transient window containing a simple label glyph
|>before a system call and unmap the window when the system function returns.
|>Is there any way to do this whithout
|> tampering with the InterViews event loop?
|> I would appreciate any suggestions or alternate means of notifying the user
|>that they must wait for a system call to return.
In general, if you want to post a notifier, do some computation, then remove
the notifier, you need to force processing of the expose event(s) before
doing the computation. The example below shows one way to do it.
Unfortunately, even this approach suffers from the problem
that it won't handle an expose that occurs _during_ the computation.
A better solution appears to require multithreading.
#include <IV-look/kit.h>
#include <InterViews/background.h>
#include <InterViews/event.h>
#include <InterViews/label.h>
#include <InterViews/layout.h>
#include <InterViews/session.h>
#include <InterViews/window.h>
#include <stdio.h>
class Drawn : public MonoGlyph {
public:
Drawn(Glyph*);
virtual ~Drawn();
boolean drawn() const;
virtual void draw(Canvas*, const Allocation&) const;
private:
boolean drawn_;
};
Drawn::Drawn(Glyph* g) : MonoGlyph(g) { drawn_ = false; }
Drawn::~Drawn() { }
void Drawn::draw(Canvas* c, const Allocation& a) const {
Drawn* d = (Drawn*)this;
d->drawn_ = true;
MonoGlyph::draw(c, a);
}
inline boolean Drawn::drawn() const { return drawn_; }
int main(int argc, char** argv) {
Session session("Himom", argc, argv);
WidgetKit& kit = *WidgetKit::instance();
const LayoutKit& layout = *LayoutKit::instance();
Drawn* d = new Drawn(
new Background(
layout.hbox(
layout.hglue(72.0, 72.0, 0.0),
kit.label("hi mom!")
),
kit.background()
)
);
Window& w = *new ApplicationWindow(d);
w.map();
Event e;
while (!session.done() && !d->drawn()) {
session.read(e);
e.handle();
}
getchar();
w.unmap();
return 0;
}
Technical Details
Message-ID:
<p3pe1jk@fido.asd.sgi.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!dtix!darwin.sura.net!mips!odin!fido!marktwain.rad.sgi.com!lintonReferences:
<1992Aug21.201755.25251@eng.ufl.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!dtix!darwin.sura.net!mips!odin!fido!marktwain.rad.sgi.com!linton From: linton@marktwain.rad.sgi.com (Mark Linton) Newsgroups: comp.windows.interviews Subject: Re: Transient Window Dialog Message-ID: <p3pe1jk@fido.asd.sgi.com> Date: 27 Aug 92 16:38:27 GMT References: <1992Aug21.201755.25251@eng.ufl.edu> Sender: news@fido.asd.sgi.com (Usenet News Admin) Reply-To: linton@marktwain.rad.sgi.com (Mark Linton) Organization: sgi Lines: 71