• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Experimenting with Views (previously Noob playing with Windows)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Experimenting with Views (previously Noob playing with Windows)


  • Subject: Experimenting with Views (previously Noob playing with Windows)
  • From: Nicholas <email@hidden>
  • Date: Wed, 14 Jul 2004 21:50:22 -0400

First, thanks for the previous help.

I have a borderless and tabless Tab View which has two items. These items are changed by using a pull-down menu and pressing a "Change" Button. The view changes appropriately. Now I am trying to resize the window in which the tab view resides based on the content of the tabViewItem. I need to define an NSRect which encompasses all of my subviews for each tabViewItem. Here is my delegate method: (I am only trying to get the size of the views for now - baby steps)

- (void)tabView:(NSTabView *)tabView didSelectTabViewItem:(NSTabViewItem *)tabViewItem
{
NSLog(@"TAB DELEGATE:");
NSRect tabFrameOld, currentFrame;
NSArray *mySubViews = [[NSArray alloc] init];
NSView *views;
NSEnumerator *enumerator = [mySubViews objectEnumerator];
int index, i;

tabFrameOld = NSZeroRect;
currentFrame = NSZeroRect;

mySubViews = [tabView subviews];
NSLog(@"subview array inited");

index = [mySubViews count];
NSLog(@"There are %d subviews in this view",index);

for(i=0; i<index+1; i++)
{
views = [enumerator nextObject];
currentFrame = [views frame];
//tabFrameOld = NSUnionRect(tabFrameOld, currentFrame);
NSLog(@"currentFrame height is: %d", currentFrame.size.height);
NSLog(@"currentFrame width is: %d", currentFrame.size.width);

}
}

// Here's my output

Inited
TAB 1 Selected // This is correct
TAB DELEGATE:
subview array inited
There are 1 subviews in this view // This is also correct - an NSTextField
currentFrame height is: 0 // This makes sense
currentFrame width is: 0
currentFrame height is: 0 // This doesn't
currentFrame width is: 0

I can't seem to get the -frame method to return the proper NSRect.

Cheers,
Nick
_______________________________________________
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.


  • Follow-Ups:
    • Re: Experimenting with Views (previously Noob playing with Windows)
      • From: "Louis C. Sacha" <email@hidden>
  • Prev by Date: Re: NSTable Newbie Issues
  • Next by Date: Re: core data
  • Previous by thread: Unexpected copyWithZone invoked when adding object to NSArrayController
  • Next by thread: Re: Experimenting with Views (previously Noob playing with Windows)
  • Index(es):
    • Date
    • Thread