<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">thank you gary,<div>I did looked at the methods in the openNSPANEL class but I didnt find anything mentioning "directory"...</div><div>but then i'm not at cocoa expert... (either..;-))</div><div>I will look at this and try to figure it out.</div><div><br></div><div>it seems to me that easygui is a package that is made a little ad hoc, "for now", to resolve urgent needs now. and the gui package is part of the "real" cocoa communication in clozure ccl... </div><div>and perhaps in a future better version the easygui will be obsolete but the gui package not...</div><div><br></div><div>I am of course still waiting for some window functions in ccl, and for the moment being I dont know on wich horse I should bet...</div><div>could someone enlighten me?</div><div><br></div><div>Very Sincerely</div><div>Joakim</div><div><br></div><div><br></div><div> <br><div><div>Le 3 mai 09 à 22:15, Gary Byers a écrit :</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>(#/runModalForTypes: panel <possibly null NSArray of file types>)<br><br>is equivalent to:<br><br>(#/runModalForDirectory:file:types: panel +null-ptr+ +null-ptr+ <possibly-null-types-array>)<br><br>As one would guess from the method name, the two extra arguments accepted by the<br>second function are an NSString denoting an absolute directory name and an NSString<br>denoting a file in that directory. So the general idea is:<br><br>(defun choose-directory-dialog (&optional default-directory)<br> (execute-in-gui #'(lambda ()<br> ...<br> (let* ((dirname (if default-directory<br> (#/autorelease<br> (ccl::%make-nsstring<br> (namestring (truename default-directory))))<br> +null-ptr+)))<br> ...<br> (when (eql (#/runModalForDirectory:file:types:<br> panel<br> dirname<br> +null-pointer+<br> +null-pointer+)<br> #$NSOKButton)<br> ...)))))<br><br><<a href="http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSOpenPanel_Class/Reference/Reference.html">http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSOpenPanel_Class/Reference/Reference.html</a>><br>is actually a good description of the functionality that NSOpenPanel offers; if<br>you have Xcode installed, a local copy of the reference documentation is buried<br>somewhere inside the Xcode installation directory (usually /Developer) someplace,<br>and you may be able to find it ...<br><br>Since it hasn't been plugged for a while, this seems like a good time to mention<br>AppKido (<<a href="http://homepage.mac.com/aglee/downloads/appkido.html">http://homepage.mac.com/aglee/downloads/appkido.html</a>>), which is a good,<br>free (well, the author accepts donations via PayPal now) tool for browsing a local<br>copy of the Cocoa documentation.<br><br>On Sun, 3 May 2009, Joakim Sandgren wrote:<br><br><blockquote type="cite">Hi, and thank you all for helping so much with my questions.<br></blockquote><blockquote type="cite">here's another:<br></blockquote><blockquote type="cite">based on the function choose-directory-dialog in the GUI package I have done another function adding some title strings, one for the panel one for the button.<br></blockquote><blockquote type="cite">Now I would like to add the functionality that the panel opens in a default directory choosen by me.<br></blockquote><blockquote type="cite">How do I do that?<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Sincerely<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Joakim<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">(defun choose-directory-dialog ()<br></blockquote><blockquote type="cite">(execute-in-gui #'(lambda ()<br></blockquote><blockquote type="cite"> (let ((op (#/openPanel ns:ns-open-panel)))<br></blockquote><blockquote type="cite"> (#/setAllowsMultipleSelection: op nil)<br></blockquote><blockquote type="cite"> (#/setCanChooseDirectories: op t)<br></blockquote><blockquote type="cite"> (#/setCanChooseFiles: op nil)<br></blockquote><blockquote type="cite"> (when (eql (#/runModalForTypes: op +null-ptr+) #$NSOKButton)<br></blockquote><blockquote type="cite"> ;; #/stringByStandardizingPath seems to strip trailing slashes<br></blockquote><blockquote type="cite"> (let* ((path (#/retain (#/stringByAppendingString:<br></blockquote><blockquote type="cite"> (#/stringByStandardizingPath<br></blockquote><blockquote type="cite"> (#/objectAtIndex: (#/filenames op) 0))<br></blockquote><blockquote type="cite"> #@"/"))))<br></blockquote><blockquote type="cite"> path))))))<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">(defmethod choose-directory-dialog-with-strings ((dialogtitle string) (buttonstring string))<br></blockquote><blockquote type="cite">(gui::lisp-string-from-nsstring<br></blockquote><blockquote type="cite"> (gui::execute-in-gui #'(lambda ()<br></blockquote><blockquote type="cite"> (let ((op (#/openPanel ns:ns-open-panel)))<br></blockquote><blockquote type="cite"> (#/setAllowsMultipleSelection: op nil)<br></blockquote><blockquote type="cite"> (#/setCanChooseDirectories: op t)<br></blockquote><blockquote type="cite"> (#/setCanChooseFiles: op nil)<br></blockquote><blockquote type="cite"> (#/setPrompt: op (ccl::%make-nsstring buttonstring))<br></blockquote><blockquote type="cite"> (#/setTitle: op (ccl::%make-nsstring dialogtitle))<br></blockquote><blockquote type="cite"> (when (eql (#/runModalForTypes: op +null-ptr+) #$NSOKButton)<br></blockquote><blockquote type="cite"> ;; #/stringByStandardizingPath seems to strip trailing slashes<br></blockquote><blockquote type="cite"> (let* ((path (#/retain (#/stringByAppendingString:<br></blockquote><blockquote type="cite"> (#/stringByStandardizingPath<br></blockquote><blockquote type="cite"> (#/objectAtIndex: (#/filenames op) 0))<br></blockquote><blockquote type="cite"> #@"/"))))<br></blockquote><blockquote type="cite"> path)))))))<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Joakim Sandgren<br></blockquote><blockquote type="cite">joakim sandgren musik<br></blockquote><blockquote type="cite">42, rue de Maubeuge<br></blockquote><blockquote type="cite">75009 Paris<br></blockquote><blockquote type="cite">France<br></blockquote><blockquote type="cite">+33 (0)1 45 26 43 90<br></blockquote><blockquote type="cite"><a href="mailto:info@joakimsandgren.com">info@joakimsandgren.com</a><br></blockquote><blockquote type="cite"><a href="http://www.joakimsandgren.com">http://www.joakimsandgren.com</a><br></blockquote><blockquote type="cite"><br></blockquote><br></div></blockquote></div><br><div> <span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><div><font class="Apple-style-span" color="#595959" face="'Trebuchet MS'"><br class="Apple-interchange-newline"><br></font></div><div><font class="Apple-style-span" color="#595959" face="'Trebuchet MS'"><br></font></div><div><font class="Apple-style-span" face="'Trebuchet MS'" color="#595959">Joakim Sandgren</font></div><div><font class="Apple-style-span" face="'Trebuchet MS'" color="#595959">joakim sandgren musik</font></div><div><font class="Apple-style-span" face="'Trebuchet MS'" color="#595959">42, rue de Maubeuge</font></div><div><font class="Apple-style-span" face="'Trebuchet MS'" color="#595959">75009 Paris</font></div><div><font class="Apple-style-span" face="'Trebuchet MS'" color="#595959">France</font></div><div><font class="Apple-style-span" face="'Trebuchet MS'" color="#595959">+33 (0)1 45 26 43 90</font></div><div><font class="Apple-style-span" face="'Trebuchet MS'" color="#595959"><a href="mailto:info@joakimsandgren.com">info@joakimsandgren.com</a></font></div><div><font class="Apple-style-span" face="'Trebuchet MS'" color="#595959"><a href="http://www.joakimsandgren.com/">http://www.joakimsandgren.com</a></font></div></span> </div><br></div></body></html>