Re: question about frame and bounds
Re: question about frame and bounds
- Subject: Re: question about frame and bounds
- From: "Ivan S. Kourtev" <email@hidden>
- Date: Sun, 19 Oct 2003 17:01:37 -0400
At 10:24 PM 10/19/2003 +0200, j o a r wrote:
Choice #2: Not know the hierarchy but for every interface object do
something like this:
register id interface_object = /* the object in question */;
register NSView *containing_window = [[interface_object window]
contentView];
register NSView *containing_view = interface_object;
assert( containing_view != containing_window );
while ( YES ) {
register NSView* superview = [containing_view superview];
if ( superview == containing_window )
{ break; }
else
{ containing_view = superview; }
}
/* containing_view contains the outermost superview of
interface_object that is
NOT the containing window */
You should write:
if (superview == [window contentView])
break;
I am confused. Isn't that exactly what the code above is doing (except for
the perhaps inappropriate choice of variable name for NSView
*containing_view)? This did seem to work.
Why don't you tell us what you're trying to do - that would make it
easier to tell you what is the most efficient way to go about doing it.
At any rate, what I am trying to do is dynamically change the size and
appearance of the main application window based on the program state. For
example, when the user selects a certain action, a file must be read in. At
this point, I would like to:
(a) resize the window a little larger (already know how to do that with
setFrame:display:animate),
(b) show a progress bar and a bunch of NSTextField's in the new window area
(c) read the file, indicating progress with progress bar, fill out
NSTextFields
(d) when user is done, resize window back to normal (get rid of progress
bar, NSTextFields, etc.)
So, according to an example I have seen, I create the entire interface in
PB. In awakeFromNib I want to hide this portion of the main window
interface which is not needed yet. So I wanted to get the dimensions and
positions of interface objects (in the portion to be hidden) in order to
calculate how much does the main window need to shrink (and hide the
objects that are not needed for display).
Thanks,
-- ivan
_______________________________________________
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.