• 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
Re: Dynamically created widgets
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Dynamically created widgets


  • Subject: Re: Dynamically created widgets
  • From: Ondra Cada <email@hidden>
  • Date: Thu, 18 Oct 2001 02:49:36 +0100

Brian,

BL> On Wednesday, October 17, 2001, at 05:57 AM, Ondra Cada wrote:
BL> >The easiest way is preparing NIBs containing partial views (like "all
BL> >widgets related to one channel", or whatever), loading them multiple
BL> >times
BL> >(once for each channel, etc).
>>>>>> Brian Luft (BL) wrote at Wed, 17 Oct 2001 18:58:01 -0500:
BL> How would I go about doing this? Is there any documentation on this
BL> subject that I should read? I'm afraid I'm *very* new to Cocoa and this
BL> whole environment. :-/

Well, it's not extremely difficult, but I would really recommend first
making a few "normal" application with static NIBs, just to get familiar with
Cocoa.

Otherwise, well, the general trick is
- somewhere prepare a parent view which will contain those loaded ones.
Probably the best class for that is NSBox, but you can use plain NSView, or
your own subclass, or so. Prepare it "normally" in IB, and bind it to an
outlet, say, "parent";
- prepare another NIB with just the view which should be repeated (again,
probably NSBox, but can be anything; drop it over the NIB main window, bind
it to an outlet, say, "aView" of File Owner).

Then do something like

NSPoint pt=NSMakePoint(0,0);
for (...all channels or whatever...) {
[NSBundle loadNibNamed:... owner:self];
[aView setFrameOrigin:pt];
pt.x+=NSWidth(frame)+GAPSIZE; // or pt.y+=NSHeight(frame) or so...
[parent addSubview:aView];
}

For starters, it should be sufficient.
---
Ondra Cada
OCSoftware: email@hidden http://www.ocs.cz
2K Development: email@hidden http://www.2kdevelopment.cz
private email@hidden http://www.ocs.cz/oc


References: 
 >Re: Dynamically created widgets (From: Brian Luft <email@hidden>)

  • Prev by Date: Re: AppKit doesn't honor "Untitled" document handling - why?
  • Next by Date: Re: AppKit doesn't honor "Untitled" document handling - why?
  • Previous by thread: Re: Dynamically created widgets
  • Next by thread: Current Document
  • Index(es):
    • Date
    • Thread