Creating a criteria search view
Creating a criteria search view
- Subject: Creating a criteria search view
- From: Steve Palmer <email@hidden>
- Date: Mon, 19 Apr 2004 17:52:48 -0700
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
unarchiveObjectWith
Data: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.