Featured post
cocoa - NSOpenPanel from C++ boost thread -
i'm invoking nsopenpanel thread created boost c++.
the panel behaves erratically , doesn't respond mouse, clicking on objects nothing sometime when clicking on top level combo box improve response.
do i've run separate runloop i'm doing runmodalfordirectory should take care of running own loop.
i've created separate objc class performselectoronmainthread show panel in main thread still behavior same.
[ps performselectoronmainthread:@selector(showopenpanel) withobject:nil waituntildone:yes modes:[nsarray arraywithobject:nsrunloopcommonmodes]];
i've tried waituntildone:no , running cfrunloopruninmode isn't helping either.
- (bool) showopenpanel { nsopenpanel *op = [nsopenpanel openpanel]; [op setallowsmultipleselection:yes]; [op settitle:@"choose file"]; [op setmessage:@"choose file importing."]; [op setfloatingpanel:true]; bool result =[op runmodalfordirectory:nshomedirectory() file:nil types:self.filetypes]; if (result == nsokbutton) { [self setselectedfiles:[op filenames]]; [self setlastshowresult:true]; } else { [self setlastshowresult:false]; } [self setpanelisdone:true]; return self.lastshowresult; }
nsopenpanel
part of appkit. appkit functions , classes can safely used on main thread.
show code used performselectoronmainthread
can figure out why might still seeing problems. suspect you're calling individual methods it--don't; won't work way expect. call main thread totality of interaction nsopenpanel
.
- Get link
- X
- Other Apps
Comments
Post a Comment