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

Disturbing Control Problem in Tiger


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

I am having many unsolvable problems in Tiger dealing with controls created programatically rather than in Interface Builder. Many features simply do not work in code that worked fine before. Here is an example:

1. Create one control in IB (in this case a check box)

2. In program, copy that control to another NSBox using

- (void)copyButton:(NSButton *)srcBtn ofType:(NSButtonType)aType toBox:(NSBox *)box
{
    // create new NSButton
    NSButton *newBtn=[[NSButton alloc] init];
    [newBtn setFrame:[srcBtn frame]];
    [box addSubview:newBtn];

    

    // copy properties from source button
    NSButtonCell *btnCell=[newBtn cell];
    NSButtonCell *srcCell=[newBtn cell];
    [btnCell setButtonType:aType];
    [btnCell setControlSize:[srcCell controlSize]];
    [btnCell setFont:[srcCell font]];
    [btnCell setTitle:[srcCell title]];
    [btnCell setBezelStyle:[srcCell bezelStyle]];
    [btnCell setImage:[srcCell image]];
    [btnCell setImagePosition:[srcCell imagePosition]];

    

    // release and return
    [newBtn release];
}

3. Finally set delegate and target of the new button

When used for check boxes, both the original and the copied button work, but the new button does not change state when clicked. When clicked it sends a message to the target in which [control state] has the correct value (i.e. toggles between on and off), but the returned state of the control does not match the visual state of the control. The original button created in IB, however, works fine (all in the same code). Furthermore, this identical code worked correctly before Tiger?

Has any one else had problems with programatically created controls in Tiger?

---------------
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>
  • Prev by Date: Re: Changing drag-on selection highlight in NSTableView/NSOutlineView
  • Next by Date: Re: Link C library in Cocoa.
  • Previous by thread: Re: CoreData: get/set methods in undo and flushing of caches
  • Next by thread: Re: Disturbing Control Problem in Tiger
  • Index(es):
    • Date
    • Thread