[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to make a window visible ?
From: |
Pete French |
Subject: |
Re: How to make a window visible ? |
Date: |
Mon, 14 Jan 2002 15:27:09 +0000 |
> If it's not a patch program, that is, if this program needs some event
> input from the user interacting with it's GUI, then whatever the way
> the program is launched, you'll be better off with a NSApplication
> instance and an event loop.
Unfortunately its not a program I am writing from scratch (the piece of code
I posted is a short example of what I am trying to do). We have several
pieces of code which assume a graphics interface of the type
open_window()
draw_in_window()
close_window()
The most obvious example is the OpenStep/NeXTStep port of gnuplot, or
also the port of xmame. It dont really get a choice in this, I have to
create windows programatically :-(
> Now, supposing you just need to have a modal loop and then exit the
> program, then this can be done without any problem in the
> applicationDidFinishLaunching: method. Just run your modal loop here,
> then [NSApp terminate].
Thats an interesting thought- though I would have to somehow redefine the
programs exiting "main()" and then call that again from within the
appDidFinishLaunching method (plus find a way of getting at argv and argc)
> Even if your program had no GUI, you could still be better off
> starting a NSApplication instance, for example, to manage as events
I agree 100% - and when I write from scratch thats what I do. But I cant
do that in this situation because its an existingpiece of code that I am trying
to port.
What I am trying to do should also work, however, and it almost does. I
just cannot find a way to flush my drawing output to the screen! I have found
that I can draw into the NSview, and if I then drag the window off screen and
back on again then the drawing appears.
Benn working my way down through what the modal run for a panel does, but
I cant find the place where the panel is flushed to the screen. Panels
work without a run loop being created, so I know its possible somehow...
cheers,
-bat.