Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: FileDialog causes menus to disappear (addendum)



Thus spake Tom:
> 
> Okies. It's quite simple really; the class (setUpMenu) builds the =20
> menu, populates it with the corresponding items, and sets keyboard =20
> shortcuts where appropriate. Menu items whose behaviour will not =20
> change according to where they have been invoked in the application =20
> have their ActionListener methods declared within setUpMenu. All this =20=
> 
> is done in the constructor, and the class returns the finished menu =20
> bar at the end.
> 
> The classes that require menus create a new instance of setUpMenu. If =20=
> 
> certain menu items are to behave differently when called from a =20
> different part of the program, then the appropriate ActionListeners =20
> are created in the respective class(es).
> 
> For example, my program gives the user the option of deleting a file. =20=
> 
> Since file deletion will work in the same way, regardless of where in =20=
> 
> the program it has been invoked, the ActionListener to handle this =20
> event is declared in setUpMenu.
> 
> When it comes to opening a file, however, the app behaves in a =20
> slightly different fashion. If you've used HyperCard before, you'll =20
> know that when the program loads you're presented with a window that =20
> is generally known as the "Home screen". My program was intended to be =20=
> 
> an OS X HyperCard interpreter, so I emulated that screen. Now what =20
> ordinarily happens in a HyperCard session is that when a file (or =20
> 'stack' as they're called in HC) is loaded, the Home screen =20
> disappears, and is replaced by a new window containing the the just-=20
> loaded stack's startup screen.
> 
> Though the above may sound longwinded (heh heh!) it actually is quite =20=
> 
> relevant, because the ActionListener for opening files needs to be =20
> tailored to load the class that will handle the file (which, in my =20
> case, opens a new window) and dispose of the Home screen. This is true =20=
> 
> when "Open Stack" is invoked from the Home screen. But if I want to =20
> open a stack when I already have one loaded, I need to destroy the =20
> existing window and create a new one which will display the chosen =20
> file =97 I don't need to do anything to the Home screen.
> 
> What I'm trying to get at is that certain menu items need to do =20
> different things depending on where they have been invoked, and the =20
> only way for them to do this successfully (without having to piss =20
> about with global booleans) is by setting the appropriate =20
> ActionListener(s) in the appropriate class(es).
> 
> I hope that helps, but if you find there's something that you would =20
> like me to clarify further, then just give me a shout.
> 
> Tom

Thanks for the description. We don't have any frame-dependant behavior
like that (at least not right now). I'll keep this approach in mind.

-- 
J.
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden

References: 
 >FileDialog causes menus to disappear (From: Joel Uckelman <email@hidden>)
 >Re: FileDialog causes menus to disappear (addendum) (From: Tom <email@hidden>)
 >Re: FileDialog causes menus to disappear (addendum) (From: Joel Uckelman <email@hidden>)
 >Re: FileDialog causes menus to disappear (addendum) (From: Tom <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.