Lisp HUG Maillist Archive

:browse-file and directories?

After using Lispworks professionally[1] for about a year and a half,
I've finally started looking at non-console applications. My first GUI
application has the following interface definition:

(capi:define-interface export ()
  ()
  (:panes
   (server capi:text-input-pane
           :title "Server:"
           :visible-min-height '(:character 1)
           :visible-max-height '(:character 1)
           :reader server-pane)
   (input-file capi:text-input-pane
               :title "Input file:"
               :buttons (list :cancel nil :ok nil :browse-file (list
:filter "*.txt"))
               :reader input-file-pane)
   (output-directory capi:text-input-pane
                     :title "Output directory:"
                     :buttons (list :cancel nil :ok nil :browse-file
(list :ok-check 'lw:file-directory-p))
                     :reader output-directory-pane)
   (do-it capi:push-button
          :text "Do it!")
   (collector capi:collector-pane
              :title "Messages:"))
  (:layouts
   (main-layout capi:column-layout
                '(input-layout output-layout))
   (input-layout capi:column-layout
                 '(server input-file output-directory do-it))
   (output-layout capi:row-layout
                  '(collector))))

The part that I'm struggling with at the moment is the
"output-directory" pane. My initial guess (or hope) was that there
would be a :browse-directory option with similar behaviour to
:browse-file, but that does not seem to be the case. The "Search
Files" tool in the IDE has something similar to what I want, but it
looks and behaves differently from what :browse-file does.

Any hints?

Footnotes:
[1] Or at least, "at work".


Re: :browse-file and directories?

Raymond Wiker wrote on Tue, 21 Feb 2012 15:32:38 +0100 18:32:

| ...snip...|
|    (output-directory capi:text-input-pane
|                      :title "Output directory:"
|                      :buttons (list :cancel nil :ok nil :browse-file
|   (list :ok-check 'lw:file-directory-p))
|                      :reader output-directory-pane)
| 
| The part that I'm struggling with at the moment is the
| "output-directory" pane. My initial guess (or hope) was that there
| would be a :browse-directory option with similar behaviour to
| :browse-file, but that does not seem to be the case. The "Search
| Files" tool in the IDE has something similar to what I want, but it
| looks and behaves differently from what :browse-file does.

I would recommend something like this as a replacement:

(output-directory capi:text-input-pane
  :buttons '(:completion t :ok nil)
  :completion-function 
    (lamba (pane string)
     (capi:prompt-for-directory "Select a directory" ...)))
--
Sincerely,
Dmitriy Ivanov
lisp.ystok.ru


Re: :browse-file and directories?

On Wed, Feb 22, 2012 at 7:20 AM, Dmitriy Ivanov
<ystok-systema@rambler.ru> wrote:
> Raymond Wiker wrote on Tue, 21 Feb 2012 20:08:27 +0100 23:08:
>
> |> (output-directory capi:text-input-pane
> |>  :buttons '(:completion t :ok nil)
> |>  :completion-function
> |>    (lamba (pane string)
> |>     (capi:prompt-for-directory "Select a directory" ...)))
> |
> |
> | Thank you - this works almost perfectly (the only issue is the image on
> | the complete button :-)
>
> No problem. For example:
>
> (gp:register-image-translation 'ellipsis
>  #.(gp:read-external-image (lw:current-pathname "images/ellipsis.bmp")
>                            :transparent-color-index 1))
>
>  (output-directory capi:text-input-pane
>  :buttons '(:completion  (:image ellipsis) :ok nil)
>  ...)

Thanks (again :-)

I ended up using (:image capi::browse-file), and using the same
mechanism for input-file and output-directory, intsead of using the
:browse-file button for input-file.


Updated at: 2020-12-10 08:36 UTC