home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.next.programmer
- Path: sparky!uunet!cs.utexas.edu!uwm.edu!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!mcdchg!laidbak!katzung
- From: katzung@i88.isc.com (Brian Katzung)
- Subject: Re: InterfaceBuilder: No KeyAndOrderFront at app's startup??
- Message-ID: <1993Jan08.213027.8670@i88.isc.com>
- Keywords: ProjectBuilder; InterfaceBuilder; makeKeyAndOrderFront
- Sender: usenet@i88.isc.com (Usenet News)
- Nntp-Posting-Host: laitnite.i88.isc.com
- Organization: Interactive Systems Corporation, Naperville, IL
- References: <1993Jan5.130920.29274@oce.nl>
- Date: Fri, 08 Jan 1993 21:30:27 GMT
- Lines: 47
-
- 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;
- }
-