• 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: Disturbing Control Problem in Tiger
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Disturbing Control Problem in Tiger


  • Subject: Re: Disturbing Control Problem in Tiger
  • From: John Nairn <email@hidden>
  • Date: Thu, 23 Jun 2005 16:51:15 +0200

I tried to simplify the code in the example and made an error on the btnCell and srcCell. Yes they are actually different. Using the default initializer makes not difference because I set the frame in the next line anyway (I tried it to be sure).

I found even more problems:

1. Check [control state] and find it OFF
2. call [control setState:NSOnState]
3. Check [control state] and it is indeed on

But the check box control never gets checked. In other words, the appearance of the copied control does not match the appearance of the IB control.

Regarding why I copied button this way, it is just one example. I have many code needs to create controls while the program is running. All thus code worked before Tiger; now much of it is broken. The example with the checkbox is particularly troublesome because as illustrated about setting the control state changes the control state but does not change its appearance?

On Jun 23, 2005, at 4:35 PM, Fritz Anderson wrote:

On 23 Jun 2005, at 9:15 AM, John Nairn wrote:

    NSButton *newBtn=[[NSButton alloc] init];
    [newBtn setFrame:[srcBtn frame]];

-init is not the designated initializer for NSButton (or any NSView). -initWithFrame: is.

    [box addSubview:newBtn];
    
    // copy properties from source button
    NSButtonCell *btnCell=[newBtn cell];
    NSButtonCell *srcCell=[newBtn cell];
    [btnCell setButtonType:aType];
    [btnCell setControlSize:[srcCell controlSize]];

From this last line, I don't think you mean to initialize srcCell and btnCell to be the same thing.

Query on why you are using cell methods to copy traits that can be copied at the control level. Pick up AppKiDo, <http://homepage.mac.com/aglee/downloads>, for a tool that will let you see all the inherited methods of a framework's class.

    -- F


---------------
John Nairn (1-801-581-3413, FAX:1-801-581-4816)
Web Page: http://www.mse.utah.edu/~nairn

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Disturbing Control Problem in Tiger
      • From: Fritz Anderson <email@hidden>
References: 
 >Disturbing Control Problem in Tiger (From: John Nairn <email@hidden>)
 >Re: Disturbing Control Problem in Tiger (From: Fritz Anderson <email@hidden>)

  • Prev by Date: Re: CoreData: get/set methods in undo and flushing of caches
  • Next by Date: Re: CoreData: get/set methods in undo and flushing of caches
  • Previous by thread: Re: Disturbing Control Problem in Tiger
  • Next by thread: Re: Disturbing Control Problem in Tiger
  • Index(es):
    • Date
    • Thread