Lisp HUG Maillist Archive

Pathname

Hello everybody,

I'm programming with Lispworks and I have a little difficulty with the
following (btw, I do not have a lot of experiency programming in Lisp)
what I want to do is to have a pathname-selector that gives to an object
the pathname (a string) for manipulating a file. I haven't been able of
giveing this data to the object.
anyone knows how to do it? I can send the source code if you want...

thanks in advance,
regards,
Miro Casanova


Re: Pathname

Miro Casanova <mcasanov@vub.ac.be> writes:

> I'm programming with Lispworks and I have a little difficulty with the
> following (btw, I do not have a lot of experiency programming in Lisp)
> what I want to do is to have a pathname-selector that gives to an object
> the pathname (a string) for manipulating a file. I haven't been able of
> giveing this data to the object.
> anyone knows how to do it? I can send the source code if you want...

I don't understand what you try to do. If you have an object and you
want to associate a pathname with it, add a pathname slot to the
class.

-- 
Hai koe, zei de stier,
Kom mee met mij in de wei,
Dan zijn we tweezaam.
Lieven Marchand <mal@wyrd.be>


Re: Pathname

Capi:pathname-selector isn't documented in my 4.2 windows lispworks and, when I try to compile and run your code, I get a runtime failure stating that pathname-selector doesn't even exist.

I think that you are trying to get the name of a file interactively.  Here's a test program that waits for a button press, brings up a file selector dialog, converts the returned pathname to a string and displays the string in a text field on the same dialog.  Compile-and-load it, then type (test)<RETURN> in the listener.

Hope this helps.

pt



(capi:define-interface importer-pathname-selector ()
  ()
  (:panes
   (push-button-1
    capi:push-button
    :text "Browse"
    :callback #'common-lisp-user::my-button-callback)
   (text-input-pane-1
    capi:text-input-pane
    :accessor my-text))
  (:layouts
   (column-layout-1
    capi:column-layout
    '(push-button-1 text-input-pane-1)))
  (:default-initargs
   :best-height 40
   :best-width 104
   :layout 'column-layout-1
   :title "Choose the structure file: "))

(defun my-button-callback (data interface)
  (let ((path-name
         (capi:prompt-for-file "Enter a filename:"
                               :filter "*.lisp"
                               :filters '("All Files" "*.*"))))
    (setf (capi:text-input-pane-text (my-text interface)) (namestring path-name))))

(defun test ()
  (capi:contain (make-instance 'importer-pathname-selector)))
 


Updated at: 2020-12-10 09:01 UTC