question about frame and bounds
question about frame and bounds
- Subject: question about frame and bounds
- From: Ivan Kourtev <email@hidden>
- Date: Sun, 19 Oct 2003 13:28:52 -0400
Hello,
I am trying to do programmatic resizing of windows based on the
required state of the user interface (certain objects only need to be
shown in the UI under certain conditions). So my approach is to build
my entire interface in IB, then obtain programmatically dimensions of
objects, then make resizing decisions based on these dimensions and UI
state. In any case, I have a separator line and the following piece of
code
/***********************/
register NSRect rect;
register NSPoint origin;
register NSSize size;
rect = [separator frame];
origin = rect.origin;
size = rect.size;
NSLog( @"separator:frame = (%f, %f, %f, %f)", origin.x, origin.y,
size.width, size.height );
rect = [separator bounds];
origin = rect.origin;
size = rect.size;
NSLog( @"separator:bounds = (%f, %f, %f, %f)", origin.x, origin.y,
size.width, size.height );
/***********************/
produces this output:
2003-10-19 12:03:38.108 V[3441] separator:frame = (2.000000, 2.000000,
665.000000, 1.000000)
2003-10-19 12:03:38.108 V[3441] separator:bounds = (0.000000, 0.000000,
665.000000, 1.000000)
Isn't there something wrong with this output? As I understand it
(a) the view is the separator line ('separator' object in code)
(b) the view frame is the view area in the superview coordinate system
(c) the view bounds is the view area in the view's own coordinate system
So if my understanding is correct (which perhaps it is not), my
separator line has larger length in its own coordinate system than in
the superview's coordinate system.
My confusion was further deepened when I looked into the IB inspector
for theseparator line. The actual dimensions of the separator line
show as width = 669, height = 1, and origin (in the containing window,
I assume) 12, 90. So I am beginning to suspect that the superview of
the separator line is NOT the window but something else? That still
doesn't seem to explain to me the size mystery -- how can the two sizes
be different?
Can anyone offer some insight as to what am I doing/assuming that is
wrong? 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.