Re: Controlling widths in PROMPT-WITH-LIST &C
----- Original Message -----
From: "Tim Bradshaw" <tfb@cley.com>
To: <lisp-hug@xanalys.com>
Sent: Wednesday, February 12, 2003 2:35 PM
Subject: Controlling widths in PROMPT-WITH-LIST &C
> I have an application which calls CAPI:PROMPT-WITH-LIST with a list of
> potentially very long strings. This results in a rather silly
> dialogue box... There must be a way to control the width of it short
> of truncating the strings (which is bad, because they are displayed in
> a proportional width font, so any truncation either needs to take that
> into account or look terrible) but I can't work it out. Can anyone
> help?
You can write your own dialog, here is a fairly functional start
(capi:define-interface list-panel-dialog ()
((list-max-width :initarg :list-max-width :initform nil)
(list-min-width :initarg :list-min-width :initform 150)
(list-font :initarg :list-font :initform nil)
(items :initarg :items :initform nil))
(:panes
(list-panel capi:list-panel :items items :max-width list-max-width
:min-width list-min-width
:max-width list-max-width
:max-height :screen-height
:font list-font
:callback-type :interface
:items items
:action-callback
(lambda (interface)
(capi:exit-dialog (capi:choice-selected-item (slot-value interface
'list-panel)))))
(ok-button capi:push-button :max-width :screen-width :text "OK"
:callback-type :interface
:callback (lambda (interface)
(capi:exit-dialog (capi:choice-selected-item (slot-value
interface 'list-panel)))))
(cancel-button capi:push-button :max-width :screen-width :text "Cancel"
:callback-type :interface
:callback
(lambda (interface)
(declare (ignore interface))
(capi:abort-dialog))))
(:layouts
(main capi:row-layout '(list-panel buttons))
(buttons capi:column-layout '(ok-button cancel-button)))
(:default-initargs
:min-height 250
:max-height :screen-height))
CL-USER 20 > (capi:display-dialog (make-instance 'list-panel-dialog :items '(1 2 3 4 5 6 7
8 9 10 12 "Really, really, really, lonngngnngngng string") :list-min-width 300))
NIL
NIL
CL-USER 21 > (capi:display-dialog (make-instance 'list-panel-dialog :items '(1 2 3 4 5 6 7
8 9 10 12 "Really, really, really, lonngngnngngng string") :list-min-width 150))
NIL
NIL
CL-USER 22 > (capi:display-dialog (make-instance 'list-panel-dialog :items '(1 2 3 4 5 6 7
8 9 10 12 "Really, really, really, lonngngnngngng string") :list-min-width 150 :min-height
400))
1
T
Wade