Hi,

I'm looking for some help troubleshooting some behavior with NSOpenPanel, where 
it doesn't seem to be properly validating and updating the user interface with 
respect to changes I'm making to allowedFileTypes. This is in a Document-based 
app using the 10.7 SDK, running on 10.8.3.

I've subclassed NSDocumentController as suggested in the documentation so that 
I can customize the open panel with my own accessory view. My accessory view 
contains an NSPopUpButton listing the various file types my app can open, and 
when a new file type is selected with the popup button my controller calls 
-setAllowedFileTypes: followed by -validateVisibleColumns on the NSOpenPanel, 
as suggested by the documentation.

This works, but only partially. When the file type selection is changed, I am 
no longer able to select files of the previous type, and I am only able to 
select files of the new type -- so far, so good. However, the visual appearance 
of the files listed in the open panel does not change; that is, the files that 
are no longer valid (because they don't match the selected type) are not 
grayed-out/dimmed, and those that are valid remain grayed-out/dimmed. Note that 
I can still select the valid files even though they look disabled (grayed-out), 
and I cannot select the invalid files even though they look enabled (full black 
text). This happens in 3 of the 4 file view modes (Icon, List, and Cover Flow); 
in Browser view mode, the visual appearance updates as expected to match which 
files are actually valid and selectable. I have tried additionally implementing 
-[NSOpenSavePanelDelegate panel:shouldEnableURL:], but the behavior is the same.

An additional bit of odd behavior is that in Icon, List, and Cover Flow view 
modes, if I select a valid file and then change the enabled file type, the 
selected file is deselected leaving no selection (and thus the Open button is 
disabled). However, in Browser mode the selected file is not deselected when 
the file type is changed and the Open button remains enabled, even though the 
file is no longer valid. I can click Open and my app will proceed with opening 
the selected file, even though it shouldn't be allowed because it doesn't match 
the allowedFileTypes. This seems like a bug.

Any thoughts or insight on either of these two issues?

Thanks in advance!
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to