Lisp HUG Maillist Archive

[Q] redisplaying the items of a choice widget

Hello,

Is it possible to redisplay the items of a choice widget
(e.g. LIST-PANEL) without having to change the COLLECTION-ITEMS slot?

e.g:

(setq items '(foo bar biz))
(setq items-view (make-instance 'capi:list-panel :items items))
(capi:contain items-view)
(setf (car items) 'quux)

Ideally, at this point I'd like to be able to say something like:

(redisplay items-view)

and have the `items-view' LIST-PANEL redraw the visible items.  A
broader question would be whether any kind of observer functionality
is implemented in the CAPI widgets?

The context for this question is that I'm trying to put together some
Model and View classes (per the Model-View-Controller pattern).

Thanks.

-ram


Re: [Q] redisplaying the items of a choice widget

Unable to parse email body. Email id is 418

Re: [Q] redisplaying the items of a choice widget

Unable to parse email body. Email id is 420

Re: [Q] redisplaying the items of a choice widget

davef@xanalys.com writes:

>       Is it possible to redisplay the items of a choice widget
>       (e.g. LIST-PANEL) without having to change the COLLECTION-ITEMS slot?
>
>    I don't think it is. 
>
>    - n
>
> Correct. 

Is this because LIST-PANEL caches the items to be displayed
internally?

>       e.g:
>
>       (setq items '(foo bar biz))
>       (setq items-view (make-instance 'capi:list-panel :items items))
>       (capi:contain items-view)
>       (setf (car items) 'quux)
>
>       Ideally, at this point I'd like to be able to say something like:
>
>       (redisplay items-view)
>
>       and have the `items-view' LIST-PANEL redraw the visible items.  
>
> But there's various things to do behind the scenes, including setting
> the representation and updating the sort order, and these are all done
> by (SETF CAPI:COLLECTION-ITEMS).

I'm not specifying any explicit sort order, does that make a
difference?

>                                                                      A
>       broader question would be whether any kind of observer functionality
>       is implemented in the CAPI widgets?
>
> What does observer mean here?

I was referring to the Observer design pattern, as realized in
Model-View, where object A (usually a view) "observes" (or is a
dependent of) object B (usually a model), and responds to change
notifications from object B, by redrawing itself (usually). If
LIST-PANEL provided a way to redisplay part or all of its contents,
then it would be pretty easy to add the observer capability as a
mixin.

On a related but separate note, I didn't see any way for specifying a
different visual representation (i.e. font or color specification) for
each item (first item in Blue Italics, second in Red Bold etc.) in the
LIST-PANEL collection-items. Is that a correct?

Thanks.

-ram


Re: [Q] redisplaying the items of a choice widget

Unable to parse email body. Email id is 436

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