Re: NSView setVisible: method -- NOT
Re: NSView setVisible: method -- NOT
- Subject: Re: NSView setVisible: method -- NOT
- From: Brian Webster <email@hidden>
- Date: Mon, 31 Mar 2003 12:19:35 -0600
Yes, presumably the framework must be storing the "invisible" views
somewhere. When you call removeFromSuperview, it removes the view from
the hierarchy period, and the superview will release the view, so if
the view is not retained before that, it will be deallocated upon
removal.
One problem with this method of adding/removing views is that if the
window is resized while the view is not in the view hierarchy, then
when you add the view back in, it will be placed in its old location
and will not have an updated frame based on the resizing of the window
that occurred.
On Monday, March 31, 2003, at 12:01 PM, Jeffrey Mattox wrote:
In Cocoa, then, if I have a view that has been made invisible by
AppleScript, how do I set it back to visible? I assume AS saves the
superview somewhere. Do I have to do the same earlier, when the view
is still visible? The superview will usually be the view of the main
window, but couldn't it also be the view of a box or tab, etc.?
Jeff
At 9:29 AM -0600 3/31/03, Brian Webster wrote:
On Sunday, March 30, 2003, at 11:24 PM,
email@hidden wrote:
How come AppleScript has a "visible" property for a view that can be
set true/false, but there are no setVisible:(BOOL)flag or isVisible
methods in Cocoa for NSView?
The isVisible and setIsVisible methods are implemented in the
AppleScriptKit framework as a category on NSView. This is revealed
by class-dump, since of course the ASK framework has no header files.
The implementation of these methods simply adds and removes the view
in question from its superview. This can be seen by setting the
visible flag of a view to false and then trying to access its window
property, which will then return a missing value, indicating that the
view is no longer contained in any window.
--
Brian Webster
email@hidden
http://homepage.mac.com/bwebster
--
Brian Webster
email@hidden
http://homepage.mac.com/bwebster
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.