Thread View: comp.sys.next.programmer
4 messages
4 total messages
Started by Erik Hommersom
Tue, 05 Jan 1993 13:09
InterfaceBuilder: No KeyAndOrderFront at app's startup??
Author: Erik Hommersom
Date: Tue, 05 Jan 1993 13:09
Date: Tue, 05 Jan 1993 13:09
26 lines
1434 bytes
1434 bytes
Hi there,
When I start an application, made with InterfaceBuilder in a Terminal,
it is not activated, but the Terminal application remains the active
application.
Instead I would like to have MyApplication become active after it has been
launched from a Terminal, without having to click on one of its windows.
The problem I have is that I cannot figure out where to call the method
"makeKeyAndOrderFront" if not in the main.m program generated by
InterfaceBuilder?
Can someone tell me how to activate an application at startup under these
conditions?
Thanks,
Erik Hommersom
OCE Research & Development, Venlo, The Netherlands
###########################################################
# This note does not necessarily represent the position #
# of Oce-Nederland B.V. Therefore no liability or #
# responsibility for whatever will be accepted. #
###########################################################
Re: InterfaceBuilder: No KeyAndOrderFront at app's startup??
Author: slugg jello
Date: Thu, 07 Jan 1993 02:54
Date: Thu, 07 Jan 1993 02:54
20 lines
1355 bytes
1355 bytes
In article <1993Jan5.130920.29274@oce.nl> fjh@oce.nl (Erik Hommersom) writes: > Hi there, > > When I start an application, made with InterfaceBuilder in a Terminal, > it is not activated, but the Terminal application remains the active > application. > > Instead I would like to have MyApplication become active after it has been > launched from a Terminal, without having to click on one of its windows. > > The problem I have is that I cannot figure out where to call the method > "makeKeyAndOrderFront" if not in the main.m program generated by > InterfaceBuilder? The app's delegate receives appDidInit:. In that method you can call makeKeyAndOrderFront or activateSelf:. The owner of your main nib is usually of the class NXApp and is whose delegate outlet you must set. -- Doug Kent slugg@mouthers.wa.com
Re: InterfaceBuilder: No KeyAndOrderFront at app's startup??
Author: Gordie Freedman
Date: Thu, 07 Jan 1993 06:13
Date: Thu, 07 Jan 1993 06:13
49 lines
2709 bytes
2709 bytes
In article <1993Jan5.130920.29274@oce.nl> fjh@oce.nl (Erik Hommersom) writes: > Hi there, > > When I start an application, made with InterfaceBuilder in a Terminal, > it is not activated, but the Terminal application remains the active > application. > > Instead I would like to have MyApplication become active after it has been > launched from a Terminal, without having to click on one of its windows. > > The problem I have is that I cannot figure out where to call the method > "makeKeyAndOrderFront" if not in the main.m program generated by > InterfaceBuilder? > > Can someone tell me how to activate an application at startup under these > conditions? > > Thanks, > > Erik Hommersom > OCE Research & Development, Venlo, The Netherlands > > ########################################################### > # This note does not necessarily represent the position # > # of Oce-Nederland B.V. Therefore no liability or # > # responsibility for whatever will be accepted. # > ########################################################### Ok. Assuming there is some class you have defined, and an instance of that class you have placed in Interface Builder - (if not, than define a class called Controller, instantiate an object in builder and implement the method I will describe now, as well as the delegate trick). Set the object as the application delegate from within IB (I don't know if you know all this stuff and can't wait for me to get to the point, or if you are a newbie and don't know what I'm talking about - so if this doesn't make sense, email me for more info). Implement the -appDidInit:sender instance method in the Controller class. It will get invoked on your object after the application inits, so you can do the makeKeyAndOrderFront then. Look in digi librarian in General Reference at the "Application" class documentation - it explains this and more (like how to catch when the app is ending). Works on 3.0, I don't know about 2.x ... -- >>> Gordie Freedman -> gordie@cyclesoft.com NeXTMail Yes! >>> Thou shalt not inline functions more complicated than 20
Re: InterfaceBuilder: No KeyAndOrderFront at app's startup??
Author: Brian Katzung
Date: Fri, 08 Jan 1993 21:30
Date: Fri, 08 Jan 1993 21:30
47 lines
1815 bytes
1815 bytes
It is considered rude and uncivilized for applications to
unconditionally activate themselves at startup because the
user may have activated some other application in the mean
time (see - activateSelf: (Application)).
I have included the source for "activate" that you can use to
activate your application after you "open" it. You might want
to add some enhancements such as appending ".app" if
NXPortFromName() can't find the application as specified.
-- Brian Katzung katzung@{i88.isc, swissbank}.com
//
// activate -- Tell an application to activate itself
// Brian Katzung 8 January 1993
//
// Compile with -lNeXT_s.
//
#import <appkit/appkit.h>
#import <appkit/Speaker.h>
// Activate the named application using the provided speaker
void
activate (id speaker, const char *appName)
{
BOOL yes = YES;
[speaker setSendPort: NXPortFromName(appName, NULL)];
[speaker performRemoteMethod: "activateSelf:"
with: (const char *) &yes length: sizeof(yes)];
}
int
main (int ac, char **av)
{
if (ac > 1)
{
id speaker;
speaker = [[Speaker alloc] init];
activate(speaker, av[1]);
[speaker free];
}
return 0;
}
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads