discuss-gnustep
[Top][All Lists]
Advanced

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

Re: How to make a window visible ?


From: Pascal Bourguignon
Subject: Re: How to make a window visible ?
Date: Mon, 14 Jan 2002 15:51:51 +0100 (CET)

> From: Pete French <pete@twisted.org.uk>
> Date: Mon, 14 Jan 2002 11:09:05 +0000
> 
> > Hi - from the code below, I suspect that you are trying to order your
> > window front in your main function, before the application is made active
> 
> Its not really an application - I never go into the application run loop,
> the windows are all created and drawn from within my own main code.
> 
> > ... which won't work - you can't order front any window before the
> > application is 'launched'.
> 
> Hmmm. Unfortunate if you are trying to create windows from a command
> line program (as most of the software I wish to port does). Also there
> must be some way of doing it because NSRunAlertPanel manages to
> do this with no applicaion present (in fact the example file for
> the makefiles does just this with no application in sight...)
> [...]

Do you mean, if you are trying to create windows from a batch program?

Now, if it's a batch program, why do you need to create a window?

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.

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].
 
Even  if your  program  had no  GUI,  you could  still  be better  off
starting a  NSApplication instance, for  example, to manage  as events
timeouts  or I/O  (select),  or if  it  was a  service provider,  thus
reusing code in -[NSApplication run] instead of rewritting it yourself
using low-level services of NSRunLoop.




-- 
__Pascal_Bourguignon__              (o_ Software patents are endangering
()  ASCII ribbon against html email //\ the computer industry all around
/\  and Microsoft attachments.      V_/ the world http://lpf.ai.mit.edu/
1962:DO20I=1.100  2001:my($f)=`fortune`;  http://petition.eurolinux.org/

-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/IT d? s++:++(+++)>++ a C+++  UB+++L++++$S+X++++>$ P- L+++ E++ W++
N++ o-- K- w------ O- M++$ V PS+E++ Y++ PGP++ t+ 5? X+ R !tv b++(+)
DI+++ D++ G++ e+++ h+(++) r? y---? UF++++
------END GEEK CODE BLOCK------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]