[Openmcl-devel] default directory
Joakim Sandgren
joakim at joakimsandgren.com
Sun May 3 11:55:05 PDT 2009
Hi, and thank you all for helping so much with my questions.
here's another:
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.
Now I would like to add the functionality that the panel opens in a
default directory choosen by me.
How do I do that?
Sincerely
Joakim
(defun choose-directory-dialog ()
(execute-in-gui #'(lambda ()
(let ((op (#/openPanel ns:ns-open-panel)))
(#/setAllowsMultipleSelection: op nil)
(#/setCanChooseDirectories: op t)
(#/setCanChooseFiles: op nil)
(when (eql (#/runModalForTypes: op +null-ptr
+) #$NSOKButton)
;; #/stringByStandardizingPath seems to
strip trailing slashes
(let* ((path (#/retain (#/
stringByAppendingString:
(#/stringByStandardizingPath
(#/objectAtIndex: (#/
filenames op) 0))
#@"/"))))
path))))))
(defmethod choose-directory-dialog-with-strings ((dialogtitle string)
(buttonstring string))
(gui::lisp-string-from-nsstring
(gui::execute-in-gui #'(lambda ()
(let ((op (#/openPanel ns:ns-open-panel)))
(#/setAllowsMultipleSelection: op nil)
(#/setCanChooseDirectories: op t)
(#/setCanChooseFiles: op nil)
(#/setPrompt: op (ccl::%make-nsstring
buttonstring))
(#/setTitle: op (ccl::%make-nsstring
dialogtitle))
(when (eql (#/runModalForTypes: op
+null-ptr+) #$NSOKButton)
;; #/stringByStandardizingPath seems
to strip trailing slashes
(let* ((path (#/retain (#/
stringByAppendingString:
(#/
stringByStandardizingPath
(#/
objectAtIndex: (#/filenames op) 0))
#@"/"))))
path)))))))
Joakim Sandgren
joakim sandgren musik
42, rue de Maubeuge
75009 Paris
France
+33 (0)1 45 26 43 90
info at joakimsandgren.com
http://www.joakimsandgren.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.clozure.com/pipermail/openmcl-devel/attachments/20090503/20c2ceab/attachment.htm>
More information about the Openmcl-devel
mailing list