Re: Clicking dock icon... (Still no luck!)
Re: Clicking dock icon... (Still no luck!)
- Subject: Re: Clicking dock icon... (Still no luck!)
- From: Mario Diana <email@hidden>
- Date: Wed, 21 Nov 2001 12:02:27 -0500
>
> I have no idea why you couldn't find it by searching the docs.
>
>
>
> Eric
I did find that in the docs before I ever sent out my missive. It does
me little good, however.
Look, I'm a newbie, I understand a lot, but sometimes I run into
something that I can't comprehend. I have an application built that does
everything I want it to do, and as far as I know conforms to the Human
Interface Guidelines. The Dock click thing is the one thing it lacks.
I went back to the docs after receiving all of the replies I did (which
I genuinely appreciate). I think I just don't understand. I've included
below my best effort (which I'm sure appears hopeless). In short, what I
tried to do is as follows.
I created a subclass of java.lang in IB, made an outlet to the main
window, and made it the delegate of "File's Owner." I defined a function
in that class to overload "applicationShouldHandleReopen()". My
understanding is that "File's Owner" (the Application at runtime) will
send this message to its delegate (my class). Upon receiving the message
(which I don't believe my class is actually receiving!) the overloaded
method will "makeKeyAndOrderFront()" to my window -- and all should be
well. (Note: I have it set up so that the "File > New" menu sends this
same message, and the window will in fact open. Why not then from the
dock?)
Here's my attempt at code ;-)
// Make a class in IB and have it be the delegate from "File's Owner"
(NSApplication)
public class AppWindowMediator {
// Outlet to the window you want to open upon clicking Dock icon
NSWindow mainWindow;
// Handle what happens when this delegate is sent this message
public boolean applicationShouldHandleReopen(NSApplication sender,
boolean flag) {
// If there are no open windows...
if(!flag) {
mainWindow.makeKeyAndOrderFront(sender);
} else {
;
}
// Aren't you always supposed to return false?
return false;
}
}
I'm sorry to take up so much room on the list. I just want to get this
done, and it seems crazy to woodshed for a month and a half, reading the
documentation that does exist (not to start that again!), and finally
gain the comprehension to hammer this out on my own.
Does some kind soul have the time to take a look and let me know what it
is that I'm missing?
Mario