• 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
adding subViews, not showing up
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

adding subViews, not showing up


  • Subject: adding subViews, not showing up
  • From: crucial felix <email@hidden>
  • Date: Sat, 25 Jan 2003 14:58:23 -0500

hello.

in response to a user action (clicking a button), I'm adding some views inside
of a SlotView which is a subclass of NSBox.

The SlotView appears, but the num (NSTextField) and slider (NSSlider) are not
visible. Using F-Script Anywhere, i can inspect the slot view, and it has a contentView
which is a simple NSView, which has two subviews: the num and slider.
and they have the correct frame sizes !
but i can't see them.


-(void)makeViewsIn:(SlotView*)slotView
{

NSRect frame,numFrame,sliderFrame,slice,remain;
// take a horizontal slice 40.0 tall from the top
NSDivideRect((NSRect)[slotView contentBounds],&slice,&remain,40.0,NSMaxYEdge);
// cut it into two rects
NSDivideRect(slice,&numFrame,&sliderFrame, 40.0 , NSMinXEdge);

float initValue = 0.0;
num = [[[NSTextField alloc] initWithFrame: numFrame] retain];
[num setFloatValue: initValue];
[num setTarget: self];
[num setAction: @selector(numAction:)];

slider = [[[NSSlider alloc] initWithFrame: sliderFrame] retain];
[slider setFloatValue: initValue];
[slider setTarget: self];
[slider setAction: @selector(sliderAction:)];

// addToContentView does [[self contentView] addSubview]
[slotView addToContentView: num];
[slotView addToContentView: slider];
}

what misconception am I laboring under ?
thanks for any help.

i did a separate test application where this was done at awakeFromNib, and the
views showed up. some kind of clue...

-felix
_______________________________________________
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: adding subViews, not showing up
      • From: crucial felix <email@hidden>
  • Prev by Date: Re: NSBrowser: so very, very broken
  • Next by Date: Re: Popups in PB
  • Previous by thread: (solved) Making a button show a menu when clicked
  • Next by thread: Re: adding subViews, not showing up
  • Index(es):
    • Date
    • Thread