Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

ychaturvedi

macrumors newbie
Original poster
May 23, 2011
16
0
Hi,

I am using a simple code that open a file open dialog and i am working in wxWidgets so i make a file test.mm file.

Code:
NSOpenPanel*		openPanel = [NSOpenPanel openPanel];
		
	// ask the user for file
	[openPanel setAllowsMultipleSelection:YES];
	[openPanel setDelegate:self];
	[openPanel setTitle:@"Choose some AIFF files to burn onto CD."];
	[openPanel setPrompt:@"Select"];
	
	if ([openPanel runModalForTypes:nil] == NSOKButton)
{
/// Some code here 
}

but i have problem here that when get open dialog and try to press / to paste a file path it do not allow me to paste path using key cmd+v
What may be the reason do not know ?
Please help

Yogesh
 
Last edited by a moderator:
In Mac OS X, key equivalents like Cmd+V are driven by the main menu bar. That's why they're called key equivalents. They're the keyboard equivalent to clicking an item in the main menu bar at top of the screen.

To get Cmd+V working in an NSOpenPanel, you need a menu item in your main menu bar with a Cmd+V key equivalent. This typically (if not always) is the Paste menu item in the Edit menu.

To get pasting to work when Cmd+V is hit, organise for a paste message to be sent to the text field that has focus. We do that when writing native Mac OS X Cocoa by connecting the Paste menu item to the first responder pseudo-object and having it send a paste message when clicked. The first responder pseudo-object in Cocoa is placeholder for whichever control has the focus at the time the menu item is activated.

Perhaps you need to find the equivalent to all of this in wxWidgets.

EDIT: I've just read on the wxMac port page of the wxWidgets documentation that wxWidgets uses the C-based Carbon API in the Max OS X port and not the Objective-C-based Cocoa API. I don't know Carbon. Perhaps there's a different strategy in Carbon.
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.