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

lopoz

macrumors regular
Original poster
May 10, 2005
134
9
Hello,

I have an image viewer that opens directories and loads the pictures contained in them. What I'd like to do is check the contents of the directory for the presence of pictures, BEFORE the openSheetDidEnd selector is called, show the user an alert if the directory doesn't contain any images and have the user pick another directory.

How can I achieve this?

Thanks in advance for any advice!
 

kainjow

Moderator emeritus
Jun 15, 2000
7,958
7
Setup a delegate on the open panel and implement panel:isValidFilename: - this will get called when the Open button is clicked. You can then return NO to force the user to select another file/folder.
 

lopoz

macrumors regular
Original poster
May 10, 2005
134
9
Setup a delegate on the open panel and implement panel:isValidFilename: - this will get called when the Open button is clicked. You can then return NO to force the user to select another file/folder.

Thanks! I'll try that immediately!

And there I was trying to subclass NSOpenPanel.. It wasn't working out :p
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.