Re: Creating a criteria search view
Re: Creating a criteria search view
- Subject: Re: Creating a criteria search view
- From: Steve Palmer <email@hidden>
- Date: Tue, 20 Apr 2004 19:25:49 -0700
Trying again... My specific question is: is it reasonable to assume
that addSubview:positioned:relativeTo: will automatically position the
new subview below the specified one without my needing to do any more?
I added the setFrameOrigin because I wasn't seeing this behaviour but
even that makes no difference. The views appear to be placed behind
each other.
- Steve
On Apr 19, 2004, at 5:52 PM, Steve Palmer wrote:
I'm trying to create a panel that allows users to add or remove
criteria from a query. Basically the same as the Find panel in Finder.
I have a search panel in a nib that has a custom view into which each
criteria view is to be inserted. The criteria view is a separate custom
view in the same nib. The problem is that the code only inserts the
first criteria view within the superview and subsequent criteria views
appear to be getting created behind the first one as the edges of the
controls get darker as each new view is added.
NSData * archRow;
NSView * lastView;
int rowHeight;
int c;
rowHeight = [searchCriteriaView frame].size.height;
archRow = [NSArchiver archivedDataWithRootObject:searchCriteriaView];
[searchCriteriaView removeFromSuperview];
++totalCriteria;
lastView = nil;
for (c = 0; c < totalCriteria; ++c)
{
NSView *row = (NSView *)[NSUnarchiver
unarchiveObjectWithData:archRow];
[searchCriteriaSuperview addSubview:row positioned:NSWindowBelow
relativeTo:lastView];
[row setFrameOrigin:NSMakePoint([row frame].origin.x, [row
frame].origin.y + c * rowHeight)];
lastView = row;
}
The approach I'm taking is to archive the search criteria view then
unarchive it as many times as needed. However despite the use of
addSubview:positioned:relativeTo and setFrameOrigin, this isn't adding
the new view below the previous one. I've pored over the view
documentation several times but I can't see what I'm missing.
Any ideas please?
_______________________________________________
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.
_______________________________________________
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.