bugGNUstep - Bugs: bug #26080, NSPopUpButton loaded from nib...

Group
 
 

bug #26080: NSPopUpButton loaded from nib doesn't send action message

Submitter:  Doug Simons <theeggcamefirst>
Submitted:  Fri 03 Apr 2009 08:02:55 PM UTC
   
 
Category:  Gui/AppKit Severity:  3 - Normal
Item Group:  Bug Status:  Fixed
Privacy:  Public Assigned to:  FredKiefer
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 15 Jun 2009 05:35:45 PM UTC, comment #5: 

The code has been added to GNUstep gui

Fred Kiefer <FredKiefer>
Group Member
Fri 10 Apr 2009 06:28:19 AM UTC, comment #4: 

Oops! There is a small mistake in that code. It seems that the sender of the action message should actually be the popup button, not the menu item in this case, so the code should read:
[NSApp sendAction:[self action] to:[self target] from:self];


Doug Simons <theeggcamefirst>
Thu 09 Apr 2009 11:22:22 PM UTC, comment #3: 

For now I've implemented this as a category in my code, and it solves the problem. Here's the code:

@interface NSPopUpButtonCell (CocoaExtensions)
-(void) _popUpItemAction:(id)sender;
@end

@implementation NSPopUpButtonCell (CocoaExtensions)
-(void) _popUpItemAction:(id)sender
{
  [NSApp sendAction:[self action] to:[self target] from:sender];
}
@end



Doug Simons <theeggcamefirst>
Thu 09 Apr 2009 09:14:20 PM UTC, comment #2: 

It seems that the issue is that in Cocoa, items in NSPopUpButtons that aren't assigned a specific target/action are saved in a nib file with the action _popUpItemAction: and the NSPopUpButtonCell as the target. In GNUstep, the NSPopUpButtonCell class doesn't currently implement a _popUpItemAction: method.

If such a method could be added, which would send the popup button's action to the popup button's target, but with the menu item as the sender, I believe that would resolve the problem. Thanks!


Doug Simons <theeggcamefirst>
Fri 03 Apr 2009 08:56:24 PM UTC, comment #1: 

Could you please provide a sample NIB file, plus minimal application, that demonstrates this behaviour?

Fred Kiefer <FredKiefer>
Group Member
Fri 03 Apr 2009 08:02:55 PM UTC, original submission:  

I've verified that the target and action are set correctly in an NSPopUpButton after it is loaded from a nib file, but changing the selection doesn't send the action message. I'm guessing that something isn't getting initialized properly between the button and its menu.

Doug Simons <theeggcamefirst>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by FredKiefer (Posted a comment)
  • -email is unavailable- added by theeggcamefirst (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2009-06-15 FredKiefer StatusNone Fixed
        Assigned toNone FredKiefer
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code