Ask a Question related to Mac Programming, Design and Development.
-
Eric VERGNAUD #1
NSPopupMenuButton not working
Hi,
I'm integrating Cocoa UI in a Carbon app.
I'm creating UI elements on the fly. I'm struggling with NSPopupMenuButton.
The popup button displays properly, so does the popup, but the chosen item
in the popup doesn't get selected, and I don't receive any action from the
popup. Here is my code:
// subclassing NSPopup
@interface XCocoaDropDown : NSPopUpButton {
}
- (IBAction)controlActioned:(id)sender;
// creating the popup
NSRect rect = { { 100, 100 }, { 200, 24 } };
XCocoaDropDown* dropdown = [[XCocoaDropDown alloc] initWithFrame:rect];
[dropdown setTarget: dropdown ];
[dropdown setAction:@selector(controlActioned:)];
// filling the popup
long i;
for(i=0;i<3;i++)
{
[popup addItemWithTitle:@"Hello"];
NSMenuItem* item = [dropdown lastItem];
[dropdown setEnabled:true];
[item setTarget: dropdown ];
[item setAction:@selector(controlActioned:)];
}
Does anyone know why the above doesn't work ?
Is this a problem with Cocoa menus in Carbon apps ? I also noticed that the
spellcheck menu of a NSTextView did not act on the view, but I haven't made
further investigations yet.
Thanks,
Eric
Eric VERGNAUD Guest
-
HELP PLEASE ITS NOT WORKING
After you uninstall Flash Player from all user accounts make sure that all files from C:\WINDOWS\system32\Macromed\ are removed. Instructions for... -
#38816 [Opn]: PHP code that was working perfectly recently stopped working.
ID: 38816 User updated by: mtoohee at gmail dot com -Summary: PHP code that was working perfectly recently stopped.... -
Macromedia Flash Player installed and working properly suddenlys stops working..
No idea what has caused the Flash player to stop working. This is not my machine but a relatives who has asked for help over the T'giving... -
Data not working on Label but is working in Datagrid
I am creating a simple website in Flex. I want to show different content from the database for home, about us, contact us, etc. I am using a CFC as... -
Working TableStyle Not Working on a Second DataGrid
I am having difficulty getting Tablestyles to work on a datagrid. I have 2 datasets, 1 filled and the other not. The first contains customer, stock... -
Eric VERGNAUD #2
Re: NSPopupMenuButton not working
Ok,
I've dived a little deeper and found that selecting an item in the popup,
instead of calling the action target, sends a HICommand to the main Carbon
event target.
This looks like a bug, because obviously the app doesn't know what to do
with this.
Anyone got a clue ?
Eric
> Hi,
>
> I'm integrating Cocoa UI in a Carbon app.
>
> I'm creating UI elements on the fly. I'm struggling with NSPopupMenuButton.
> The popup button displays properly, so does the popup, but the chosen item
> in the popup doesn't get selected, and I don't receive any action from the
> popup. Here is my code:
>
> // subclassing NSPopup
>
> @interface XCocoaDropDown : NSPopUpButton {
> }
> - (IBAction)controlActioned:(id)sender;
>
>
> // creating the popup
>
> NSRect rect = { { 100, 100 }, { 200, 24 } };
> XCocoaDropDown* dropdown = [[XCocoaDropDown alloc] initWithFrame:rect];
> [dropdown setTarget: dropdown ];
> [dropdown setAction:@selector(controlActioned:)];
>
> // filling the popup
>
> long i;
> for(i=0;i<3;i++)
> {
> [popup addItemWithTitle:@"Hello"];
> NSMenuItem* item = [dropdown lastItem];
> [dropdown setEnabled:true];
> [item setTarget: dropdown ];
> [item setAction:@selector(controlActioned:)];
> }
>
> Does anyone know why the above doesn't work ?
>
> Is this a problem with Cocoa menus in Carbon apps ? I also noticed that the
> spellcheck menu of a NSTextView did not act on the view, but I haven't made
> further investigations yet.
>
> Thanks,
>
> Eric
>Eric VERGNAUD Guest
-
Eric VERGNAUD #3
Re: NSPopupMenuButton not working (solved)
dans l'article BB88E3D5.11FD8%eric.vergnaud@wanadoo.fr, Eric VERGNAUD à
[email]eric.vergnaud@wanadoo.fr[/email] a écrit le 13/09/03 15:10*:
Ok, found the bug:
I was returning noErr in my main loop when receiving unhandled commands,
that is command without a HICommand in them. I changed it to return
eventNotHandledErr and now everything is ok.
What a relief.
> Ok,
>
> I've dived a little deeper and found that selecting an item in the popup,
> instead of calling the action target, sends a HICommand to the main Carbon
> event target.
>
> This looks like a bug, because obviously the app doesn't know what to do
> with this.
>
> Anyone got a clue ?
>
> Eric
>>>> Hi,
>>
>> I'm integrating Cocoa UI in a Carbon app.
>>
>> I'm creating UI elements on the fly. I'm struggling with NSPopupMenuButton.
>> The popup button displays properly, so does the popup, but the chosen item
>> in the popup doesn't get selected, and I don't receive any action from the
>> popup. Here is my code:
>>
>> // subclassing NSPopup
>>
>> @interface XCocoaDropDown : NSPopUpButton {
>> }
>> - (IBAction)controlActioned:(id)sender;
>>
>>
>> // creating the popup
>>
>> NSRect rect = { { 100, 100 }, { 200, 24 } };
>> XCocoaDropDown* dropdown = [[XCocoaDropDown alloc] initWithFrame:rect];
>> [dropdown setTarget: dropdown ];
>> [dropdown setAction:@selector(controlActioned:)];
>>
>> // filling the popup
>>
>> long i;
>> for(i=0;i<3;i++)
>> {
>> [popup addItemWithTitle:@"Hello"];
>> NSMenuItem* item = [dropdown lastItem];
>> [dropdown setEnabled:true];
>> [item setTarget: dropdown ];
>> [item setAction:@selector(controlActioned:)];
>> }
>>
>> Does anyone know why the above doesn't work ?
>>
>> Is this a problem with Cocoa menus in Carbon apps ? I also noticed that the
>> spellcheck menu of a NSTextView did not act on the view, but I haven't made
>> further investigations yet.
>>
>> Thanks,
>>
>> Eric
>>Eric VERGNAUD Guest



Reply With Quote

