• 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
Bind an NSRect
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bind an NSRect


  • Subject: Bind an NSRect
  • From: "gMail.com" <email@hidden>
  • Date: Tue, 21 Oct 2008 14:55:39 +0200
  • Thread-topic: Bind an NSRect

I would like to bind 4 NSTextFields with each of the 4 values of a NSRect
mViewFrame. So when I change a value, my view resizes automatically.
I am already able to bind the 4 float values, one by one, origins and size,
but this way I have to add 4 redundant float values and write 8 methods (4
set and 4 get) in order to go from/to the float values to the NSRect value.
For example:

- (void)setMHeight:(float)value
{
    mViewFrame.size.height = mHeight = value;
}

- (float)mHeight
{
    return mViewFrame.size.height;
}

I presume that binding should make me save time and glue code, so I think
that there should be a faster way to bind an NSRect and have at least one
method defined as

- (void)setMViewFrame:(NSRect)frame
{
    mViewFrame.size.height = frame;
    [self setNeedsDisplay:YES];
}

Any Suggestion? If there is a way, what should I set on the IB exactly?

Best Regards
--
LL


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: [JOB]: Software Engineer
  • Next by Date: Re: Properly supporting 'delete' key presses in NSTableView
  • Previous by thread: [JOB]: Software Engineer
  • Next by thread: Toolbar buttons and isEnabled binding
  • Index(es):
    • Date
    • Thread