Re: (Lisp Support Call #11669) Re: CAPI:LIST-VIEW
Ok. Looks like MULTI-COLUMN-LIST-PANEL does the trick under
Motif/Linux. Thanks.
However, the defaults are not very helpful. It'd be much better if the
view actually resized automatically according to contents as default.
Also the fonts seem to indicate that the rows are "unselected" which is
kind of ugly.
All in all, CAPI under Motif, needs a face lift. The application
defaults could be better specified.
Cheers
Marco
On Monday, Jan 20, 2003, at 13:58 America/New_York, davef@xanalys.com
wrote:
>
> Hello Marco
>
>>> I developed an interface under LW Windows using CAPI:LIST-VIEW.
>>> However, when porting this to LW Linux, I get a package error
>>> saying
>>> that the class name is unknown.
>>>
>>> FWIW I get a SIMPLE-ERROR.
>>>
>>> Has anybody experienced this problem?
>>>
>>> I don't recall it being reported before.
>>>
>>> CAPI:LIST-VIEW is implemented only in LispWorks for Windows. The
>>> documentation is in error in not mentioning that.
>>
>> Ok.... Any implementation for Linux? Porting my application
>> depends
>> on that.
>>
>> No, sorry, and it's not planned.
>
> Not very good for portability.
>
> The issue is that there's not a native Motif widget corresponding to
> the Windows ListView control. We could probably implement most of
> the functionality on Motif if it's really needed and given sufficient
> priority.
>
>>
>> So if you really do need this, please ask us on
>> lisp-support@xanalys.com.
>
> I did.
>
>> It may help if you show us how you are using
>> CAPI:LIST-VIEW on Windows (show us the actual code).
>
> This is really all I need.
>
> (bta-cl-rl-tabl-trace-details-pane
> capi:list-view
> :reader interface-traces-detail-pane
> :horizontal-scroll t
> ;; :font (gp:make-font-description :family "Lucida Console" :size 8)
> :interaction :no-selection
> :view :report
> :columns '((:title "Variable Name" :align :left)
> (:title "Max Value" :align :right)
> (:title "Min Value" :align :right)
> (:title "Max Derivative" :align :right)
> (:title "Min Derivative" :align :right))
> :print-function (lambda (item) (symbol-name (first item)))
> :subitem-function #'rest
> )
>
>> I say this
>> because it looks like rather a lot of work (more than we'd do as a
>> support incident) to imitate all the features of the Windows
>> implementation on Motif.
>>
>> Alternatively, can your application use something simpler on Motif? A
>> CAPI:MULTI-COLUMN-LIST-PANEL, with text replacing the pictures
>> perhaps?
>
>
> I have no pictures in the panel, so the CAPI:MULTI-COLUMN-LIST-PANEL
> could work as long as I can use it in both Windows and Linux.
> However,
> it is not documented.
>
> You're right that it is not in the LispWorks 4.2 manual although there
> is an example (in
> lib/4-2-0-0/examples/capi/choice/multi-column-list-panels.lisp)
>
> How can I use it?
>
> Here's the new documentation for CAPI:MULTI-COLUMN-LIST-PANEL. It's
> implemented for both Windows and Motif. Does this class suffice for
> your need?
>
> ----------------------------------------------------------------------
> multi-column-list-panel Class
>
> Summary
> A list panel with multiple columns.
>
> Superclasses
> list-panel
>
> Initargs
> :column-function
> A function of one argument. The default is identity.
>
> :item-print-functions
> A function of one argument, or a list of such functions.
>
> :columns
> A list of column specifications.
>
> :header-args
> A plist of keywords and values.
>
> :auto-reset-column-widths
> A boolean. The default is t.
>
> Description
> The class multi-column-list-panel is a list panel with multiple
> columns. The columns can each have a title.
>
> Note that this is a subclass of list-panel, and hence of choice, and
> inherits the behavior of those classes.
>
> Each item in a multi-column-list-panel is displayed in a line of
> multiple objects. The corresponding objects of each line are aligned
> in a column.
>
> The column-function generates the objects for each item. It should
> take an item as its single argument and return a list of objects to be
> displayed. The default column-function is identity, which works if
> each item is a list.
>
> The item-print-functions argument determines how to calculate the text
> to display for each element. If item-print-functions is a single
> function, it is called on each object. Otherwise item-print-functions
> should be a sequence of length no less than than the number of
> columns. The text to display for each object is the result of calling
> the corresponding element of item-print-functions on that object.
>
> The columns argument specifies the number of columns, and whether the
> columns have titles and callbacks on these titles.
>
> Each element of columns is a specification for a column. Each column
> specification is a plist of keyword and values, where the allowed
> keywords are as follows:
>
> :title
> Specifies the title to use for the column. If any of the columns has a
> title, a header object is created which displays the titles. The
> values of the :title keywords are passed as the items of the header,
> unless header-args specifies :items.
>
> :adjust
> Specifies how to adjust the column. The value can be one of :right,
> :left, or :center.
>
> :width
> Specifies the width of the columns.
>
> :visible-min-width
> Minimum width of the column.
>
> :gap
> Specifies an additional gap to the right of the text in the column.
>
> The values of :width, :visible-min-width and :gap are interpreted as
> standard geometric hints. See element for information about these
> hints.
>
> If columns is not supplied, the number of objects that the
> column-function generates defines the number of columns, or the
> maximum if the number is not the same for all items.
>
> header-args is a plist of initargs passed to the header which displays
> the titles of the columns. The header object is a collection. The
> following collection initargs are useful to pass in header-args:
>
> :selection-callback
> The callback for clicking on the header.
>
> :callback-type
> Defines the arguments of the selection-callback.
>
> :items
> The items of the header object. Note that :items overrides :title if
> that is supplied in columns.
>
> :print-function
> Controls how each of items is printed, providing the title of each
> column.
>
> header-args may also contain the keyword :alignments. The value should
> be a list of alignment keywords, each of which is interpreted like an
> :adjust value in columns. The alignment is applied to the title only.
>
> If auto-reset-column-widths is true, then the widths of the columns
> are recomputed when the items of the multi-column-list-panel are set.
>
> Example
> This example uses the columns initarg:
>
> (capi:contain
> (make-instance
> 'capi:multi-column-list-panel
> :visible-min-width 300
> :visible-min-height :text-height
> :columns '((:title "Fruits"
> :adjust :right
> :width (character 15))
> (:title "Vegetables"
> :adjust :left
> :visible-min-width (character 30)))
> :items '(("Apple" "Artichoke")
> ("Pomegranate" "Pumkpin"))))
>
> This example uses header-args to add callbacks and independent
> alignment on the titles:
>
> (defun mclp-header-callback (interface item)
> (declare (ignorable interface))
> (capi:display-message "Clicked on ~a" item))
>
> (capi:contain
> (make-instance
> 'capi:multi-column-list-panel
> :visible-min-width 300
> :visible-min-height :text-height
> :columns '((:adjust :right
> :width (character 15))
> (:adjust :left
> :visible-min-width (character 30)))
> :header-args '(:items ( "Fruits" "Vegetables")
> :selection-callback
> mclp-header-callback
> :alignments (:left :right))
> :items '(("Apple" "Artichoke")
> ("Pomegranate" "Pumkpin"))))
>
> This example uses column-function to implement a primitive process
> browser:
>
> (defun get-process-elements (process)
> (list (mp:process-name process)
> (mp:process-whostate process)
> (mp:process-priority process)))
>
> (capi:contain
> (make-instance
> 'capi:multi-column-list-panel
> :visible-min-width '(character 70)
> :visible-min-height '(character 15)
> :items (mp:list-all-processes)
> :columns '((:title "Name" :adjust :left
> :visible-min-width (character 30))
> (:title "State" :adjust :center
> :visible-min-width (character 20))
> (:title "Priority" :adjust :center
> :visible-min-width (character 12)))
> :column-function 'get-process-elements))
>
> See also
> collection
> list-panel
> ----------------------------------------------------------------------
>
>
> Regards,
>
> Dave Fox
> Xanalys Technical Support
> http://www.lispworks.com/support/
>
--
Marco Antoniotti
NYU Courant Bioinformatics Group tel. +1 - 212 - 998 3488
715 Broadway 10th FL fax. +1 - 212 - 998 3484
New York, NY, 10003, U.S.A.
--
Marco Antoniotti
NYU Courant Bioinformatics Group tel. +1 - 212 - 998 3488
715 Broadway 10th FL fax. +1 - 212 - 998 3484
New York, NY, 10003, U.S.A.