Re: Disturbing Control Problem in Tiger
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) |
_______________________________________________
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