Lisp HUG Maillist Archive

Best way to compose panes

Hi all,

I need to show a list of records where each record should show multiple panes. I looked into LIST-PANEL, LIST-VIEW, MULTI-COLUMN-LIST-PANEL but none seems to allow such behavior. Should I just create an interface class with the desired layout and panes and then create an instance of this interface for each record and add them to some layout?

Thanks in advance for the help,

Alex Paes

Re: Best way to compose panes

You can also create a subclass of some type of layout. The initialize
instance of this new class can set the layout-description automatically as
you want. After that you can create a layout with some instances of this new
class, one for each record. For instance :

(defclass myrecord (capi:grid-layout) ())

(defmethod initialize-instance :after ((self myrecord) &rest initargs)
  (declare (ignore initargs))
  (setf (capi:layout-description self) (loop for color in '(:red :green
:blue :black) 
                                             collect (make-instance
'capi:output-pane :visible-min-width 50 :visible-max-width t
                   
:visible-min-height 50 :visible-max-height t :background color))))

(capi:contain (make-instance 'capi:row-layout :description (loop for i from
0 to 3 collect (make-instance 'myrecord))))

Best

Denis


Le 23/03/10 20:56, « [NOM] » <[ADRESSE]> a écrit :

> Hi all,
> 
> I need to show a list of records where each record should show multiple panes.
> I looked into LIST-PANEL, LIST-VIEW, MULTI-COLUMN-LIST-PANEL but none seems to
> allow such behavior. Should I just create an interface class with the desired
> layout and panes and then create an instance of this interface for each record
> and add them to some layout?
> 
> Thanks in advance for the help,
> 
> Alex Paes
> 


-------------------------------------------------------
Denis Pousseur
70 rue de Wansijn
1180 Bruxelles, Belgique

Tel : 32 (0)2 219 31 09
Mail :  denis.pousseur@gmail.com
-------------------------------------------------------



Re: Best way to compose panes

Hi Denis, thank you for your answer, i tried your example and it looks like i could use this approach if it wasn't for one problem... scrolling. I tried some approaches and looking into the capi reference guide i could only find references to scrolling when dealing with panes. Do you have any idea if it's possible to have scrolling on layouts as well?

Cheers,

Alex Paes

On Tue, Mar 23, 2010 at 8:28 PM, Denis Pousseur <denis.pousseur@gmail.com> wrote:
You can also create a subclass of some type of layout. The initialize
instance of this new class can set the layout-description automatically as
you want. After that you can create a layout with some instances of this new
class, one for each record. For instance :

(defclass myrecord (capi:grid-layout) ())

(defmethod initialize-instance :after ((self myrecord) &rest initargs)
 (declare (ignore initargs))
 (setf (capi:layout-description self) (loop for color in '(:red :green
:blue :black)
                                            collect (make-instance
'capi:output-pane :visible-min-width 50 :visible-max-width t

:visible-min-height 50 :visible-max-height t :background color))))

(capi:contain (make-instance 'capi:row-layout :description (loop for i from
0 to 3 collect (make-instance 'myrecord))))

Best

Denis


Le 23/03/10 20:56, « [NOM] » <[ADRESSE]> a écrit :

> Hi all,
>
> I need to show a list of records where each record should show multiple panes.
> I looked into LIST-PANEL, LIST-VIEW, MULTI-COLUMN-LIST-PANEL but none seems to
> allow such behavior. Should I just create an interface class with the desired
> layout and panes and then create an instance of this interface for each record
> and add them to some layout?
>
> Thanks in advance for the help,
>
> Alex Paes
>


-------------------------------------------------------
Denis Pousseur
70 rue de Wansijn
1180 Bruxelles, Belgique

Tel : 32 (0)2 219 31 09
Mail :  denis.pousseur@gmail.com
-------------------------------------------------------



Re: Best way to compose panes

Re: Best way to compose panes Naturally, layout are panes : for instance pinboard-layout is a subclass of output-pane and layout (You can use the Class browser if you want to have an idea of classes inheritance). To scroll, simply set the init-arguments horizontal-scroll and/or vertical-scroll to T when you create the instance of the layout.

With the same exemple replace the last form by this :

(capi:contain (make-instance 'capi:row-layout :horizontal-scroll t :description (loop for i from 0 to 3 collect (make-instance 'myrecord))))

to get a horizontal scroll-bar

Best

Denis


Le 23/03/10 22:20, « [NOM] » <[ADRESSE]> a écrit :

Hi Denis, thank you for your answer, i tried your example and it looks like i could use this approach if it wasn't for one problem.... scrolling. I tried some approaches and looking into the capi reference guide i could only find references to scrolling when dealing with panes. Do you have any idea if it's possible to have scrolling on layouts as well?

Cheers,

Alex Paes

On Tue, Mar 23, 2010 at 8:28 PM, Denis Pousseur <denis.pousseur@gmail.com> wrote:
You can also create a subclass of some type of layout. The initialize
instance of this new class can set the layout-description automatically as
you want. After that you can create a layout with some instances of this new
class, one for each record. For instance :

(defclass myrecord (capi:grid-layout) ())

(defmethod initialize-instance :after ((self myrecord) &rest initargs)
  (declare (ignore initargs))
  (setf (capi:layout-description self) (loop for color in '(:red :green
:blue :black)
                                             collect (make-instance
'capi:output-pane :visible-min-width 50 :visible-max-width t

:visible-min-height 50 :visible-max-height t :background color))))

(capi:contain (make-instance 'capi:row-layout :description (loop for i from
0 to 3 collect (make-instance 'myrecord))))

Best

Denis


Le 23/03/10 20:56, « [NOM] » <[ADRESSE]> a écrit :

> Hi all,
>
> I need to show a list of records where each record should show multiple panes.
> I looked into LIST-PANEL, LIST-VIEW, MULTI-COLUMN-LIST-PANEL but none seems to
> allow such behavior. Should I just create an interface class with the desired
> layout and panes and then create an instance of this interface for each record
> and add them to some layout?
>
> Thanks in advance for the help,
>
> Alex Paes
>


-------------------------------------------------------
Denis Pousseur
70 rue de Wansijn
1180 Bruxelles, Belgique

Tel : 32 (0)2 219 31 09
Mail :  denis.pousseur@gmail.com
-------------------------------------------------------






-------------------------------------------------------
Denis Pousseur
70 rue de Wansijn
1180 Bruxelles, Belgique

Tel : 32 (0)2 219 31 09
Mail :  denis.pousseur@gmail.com
-------------------------------------------------------

Re: Best way to compose panes

Thank you so much Denis, i didn't notice layouts were subclasses of panes. That's what i get for not playing enough with my copy of Lispworks :P

I will try to tackle my needs with this, i'm still afraid of how this will behave with big datasets, running your example with 300 instances of 'myrecord takes about 7 seconds to display the interface.


Cheers,

Alex Paes



On Tue, Mar 23, 2010 at 9:43 PM, Denis Pousseur <denis.pousseur@gmail.com> wrote:
Naturally, layout are panes : for instance pinboard-layout is a subclass of output-pane and layout (You can use the Class browser if you want to have an idea of classes inheritance). To scroll, simply set the init-arguments horizontal-scroll and/or vertical-scroll to T when you create the instance of the layout.

With the same exemple replace the last form by this :

(capi:contain (make-instance 'capi:row-layout :horizontal-scroll t :description (loop for i from 0 to 3 collect (make-instance 'myrecord))))

to get a horizontal scroll-bar

Best

Denis


Le 23/03/10 22:20, « [NOM] » <[ADRESSE]> a écrit :

Hi Denis, thank you for your answer, i tried your example and it looks like i could use this approach if it wasn't for one problem... scrolling. I tried some approaches and looking into the capi reference guide i could only find references to scrolling when dealing with panes. Do you have any idea if it's possible to have scrolling on layouts as well?

Cheers,

Alex Paes

On Tue, Mar 23, 2010 at 8:28 PM, Denis Pousseur <denis.pousseur@gmail.com> wrote:
You can also create a subclass of some type of layout. The initialize
instance of this new class can set the layout-description automatically as
you want. After that you can create a layout with some instances of this new
class, one for each record. For instance :

(defclass myrecord (capi:grid-layout) ())

(defmethod initialize-instance :after ((self myrecord) &rest initargs)
  (declare (ignore initargs))
  (setf (capi:layout-description self) (loop for color in '(:red :green
:blue :black)
                                             collect (make-instance
'capi:output-pane :visible-min-width 50 :visible-max-width t

:visible-min-height 50 :visible-max-height t :background color))))

(capi:contain (make-instance 'capi:row-layout :description (loop for i from
0 to 3 collect (make-instance 'myrecord))))

Best

Denis


Le 23/03/10 20:56, « [NOM] » <[ADRESSE]> a écrit :

> Hi all,
>
> I need to show a list of records where each record should show multiple panes.
> I looked into LIST-PANEL, LIST-VIEW, MULTI-COLUMN-LIST-PANEL but none seems to
> allow such behavior. Should I just create an interface class with the desired
> layout and panes and then create an instance of this interface for each record
> and add them to some layout?
>
> Thanks in advance for the help,
>
> Alex Paes
>


-------------------------------------------------------
Denis Pousseur
70 rue de Wansijn
1180 Bruxelles, Belgique

Tel : 32 (0)2 219 31 09
Mail :  denis.pousseur@gmail.com
-------------------------------------------------------






-------------------------------------------------------
Denis Pousseur
70 rue de Wansijn
1180 Bruxelles, Belgique

Tel : 32 (0)2 219 31 09
Mail :  denis.pousseur@gmail.com
-------------------------------------------------------

Re: Best way to compose panes

I made my simple example with output-pane because simple-pane doesn't accept
to show a colored background, and I didn't understand that you are working
with a so big number of data. In this case you need to make something more
sophisticated : As said Martin, create 1200 output-panes when only maybe 20
or 30 of them will be visible on the screen is not very efficient...
Working with pinboard objects and draw directly the record yourself (for
instance as a subclass of pinboard-object), and draw only the visible
portion of the screen, will certainly be much more efficient. But if you
need CAPI dialogs, like text-input-pane and friends, I don't think it's the
good solution. 

But, in this case, the link to YstokGrid sent by Dmitriy seems to be the
right tool for you.

Best regards

Denis


Le 24/03/10 0:11, « [NOM] » <[ADRESSE]> a écrit :

> Thank you so much Denis, i didn't notice layouts were subclasses of panes..
> That's what i get for not playing enough with my copy of Lispworks :P
> 
> I will try to tackle my needs with this, i'm still afraid of how this will
> behave with big datasets, running your example with 300 instances of 'myrecord
> takes about 7 seconds to display the interface.
> 
> 
> Cheers,
> 
> Alex Paes
> 
> 
> 
> On Tue, Mar 23, 2010 at 9:43 PM, Denis Pousseur <denis.pousseur@gmail.com>
> wrote:
>> Naturally, layout are panes : for instance pinboard-layout is a subclass of
>> output-pane and layout (You can use the Class browser if you want to have an
>> idea of classes inheritance). To scroll, simply set the init-arguments
>> horizontal-scroll and/or vertical-scroll to T when you create the instance of
>> the layout.
>> 
>> With the same exemple replace the last form by this :
>> 
>> (capi:contain (make-instance 'capi:row-layout :horizontal-scroll t
>> :description (loop for i from 0 to 3 collect (make-instance 'myrecord))))
>> 
>> to get a horizontal scroll-bar
>> 
>> Best
>> 
>> Denis
>> 
>> 
>> Le 23/03/10 22:20, « [NOM] » <[ADRESSE]> a écrit :
>> 
>>> Hi Denis, thank you for your answer, i tried your example and it looks like
>>> i could use this approach if it wasn't for one problem... scrolling. I tried
>>> some approaches and looking into the capi reference guide i could only find
>>> references to scrolling when dealing with panes. Do you have any idea if
>>> it's possible to have scrolling on layouts as well?
>>> 
>>> Cheers,
>>> 
>>> Alex Paes
>>> 
>>> On Tue, Mar 23, 2010 at 8:28 PM, Denis Pousseur <denis.pousseur@gmail.com>
>>> wrote:
>>>> You can also create a subclass of some type of layout. The initialize
>>>> instance of this new class can set the layout-description automatically as
>>>> you want. After that you can create a layout with some instances of this
>>>> new
>>>> class, one for each record. For instance :
>>>> 
>>>> (defclass myrecord (capi:grid-layout) ())
>>>> 
>>>> (defmethod initialize-instance :after ((self myrecord) &rest initargs)
>>>>   (declare (ignore initargs))
>>>>   (setf (capi:layout-description self) (loop for color in '(:red :green
>>>> :blue :black)
>>>>                                              collect (make-instance
>>>> 'capi:output-pane :visible-min-width 50 :visible-max-width t
>>>> 
>>>> :visible-min-height 50 :visible-max-height t :background color))))
>>>> 
>>>> (capi:contain (make-instance 'capi:row-layout :description (loop for i from
>>>> 0 to 3 collect (make-instance 'myrecord))))
>>>> 
>>>> Best
>>>> 
>>>> Denis
>>>> 
>>>> 
>>>> Le 23/03/10 20:56, « [NOM] » <[ADRESSE]> a écrit :
>>>> 
>>>>> Hi all,
>>>>> 
>>>>> I need to show a list of records where each record should show multiple
>>>>> panes.
>>>>> I looked into LIST-PANEL, LIST-VIEW, MULTI-COLUMN-LIST-PANEL but none
>>>>> seems to
>>>>> allow such behavior. Should I just create an interface class with the
>>>>> desired
>>>>> layout and panes and then create an instance of this interface for each
>>>>> record
>>>>> and add them to some layout?
>>>>> 
>>>>> Thanks in advance for the help,
>>>>> 
>>>>> Alex Paes
>>>>> 
>>>> 
>>>> 
>>>> -------------------------------------------------------
>>>> Denis Pousseur
>>>> 70 rue de Wansijn
>>>> 1180 Bruxelles, Belgique
>>>> 
>>>> Tel : 32 (0)2 219 31 09
>>>> Mail :  denis.pousseur@gmail.com
>>>> -------------------------------------------------------
>>>> 
>>>> 
>>> 
>>> 
>> 
>> 
>> -------------------------------------------------------
>> Denis Pousseur
>> 70 rue de Wansijn
>> 1180 Bruxelles, Belgique
>> 
>> Tel : 32 (0)2 219 31 09
>> Mail :  denis.pousseur@gmail.com
>> -------------------------------------------------------
> 
> 


-------------------------------------------------------
Denis Pousseur
70 rue de Wansijn
1180 Bruxelles, Belgique

Tel : 32 (0)2 219 31 09
Mail :  denis.pousseur@gmail.com
-------------------------------------------------------



Re: Best way to compose panes

Hi everyone,

My record is not sophisticated all, For displaying i would basically like to show a checkbox (so that i can delete multiple records) followed by a set of 5-7 text fields in order to provide an edit-in-place functionality. I am trying to do this because this is the behavior of the web application that i was asked to port to a desktop solution..

I am now looking at ystokgrid, i took a little time to browse around the YGRID class provided by ystok.grid package and it seems he actually uses a pinboard layout to display all that stuff, obviously my knowledge of Common Lisp is quite immature for me to be sure of this. If this does the trick for me i guess i'm going to use it, but for curiosity's sake, does anyone have any idea how difficult it would be for me to implement a basic pinboard-object subclass or maybe even a pinboard-object mixin for this? I've played around with pinboard layout and objects before but never really got to fully understand them.

Best regards

Alex Paes

Re: Best way to compose panes

Here is a way to do it with existing classes. As you can see it¹s possible
to mix the use of pinboard objects and interactive CAPI panes inside a
pinboard-layout. Layouts can be used to organize the item (as here the
column-layout), but finally you must give the coordinates of your object to
the pinboard-layout. Here I give only the x.

(defclass myrecord (capi:column-layout) ())

(defmethod initialize-instance :after ((self myrecord) &rest initargs)
  (declare (ignore initargs))
  (setf (capi:layout-description self) (loop for i from 0 to 4
                                             for text in '("one" "two"
"three" "four" "five")
                                             when (< i 4) collect
(make-instance 'capi:titled-pinboard-object :title text)
                                             else collect (make-instance
'capi:check-button :text text))))

(capi:contain (make-instance 'capi:pinboard-layout :horizontal-scroll t
:description (loop for i from 0 below 300 collect (make-instance 'myrecord
:adjust :center :x (* i 100)))))

The time to build this is ±700ms on my Imac dual-core 2ghz

Best regards

Denis


Le 24/03/10 17:31, « [NOM] » <[ADRESSE]> a écrit :

> Hi everyone,
> 
> My record is not sophisticated all, For displaying i would basically like to
> show a checkbox (so that i can delete multiple records) followed by a set of
> 5-7 text fields in order to provide an edit-in-place functionality. I am
> trying to do this because this is the behavior of the web application that i
> was asked to port to a desktop solution.
> 
> I am now looking at ystokgrid, i took a little time to browse around the YGRID
> class provided by ystok.grid package and it seems he actually uses a pinboard
> layout to display all that stuff, obviously my knowledge of Common Lisp is
> quite immature for me to be sure of this. If this does the trick for me i
> guess i'm going to use it, but for curiosity's sake, does anyone have any idea
> how difficult it would be for me to implement a basic pinboard-object subclass
> or maybe even a pinboard-object mixin for this? I've played around with
> pinboard layout and objects before but never really got to fully understand
> them.
> 
> Best regards
> 
> Alex Paes
> 


-------------------------------------------------------
Denis Pousseur
70 rue de Wansijn
1180 Bruxelles, Belgique

Tel : 32 (0)2 219 31 09
Mail :  denis.pousseur@gmail.com
-------------------------------------------------------



Re: Best way to compose panes

That's true -- output-pane is relatively expensive and you are creating 1200
of them!

Why does each record need "multiple panes" (from your original description)?

If you need to display lots of records, then it would be better to have a
single scrolling pinboard-layout at the top and use pinboard-objects for the
records (or draw the records directly to a scrolling output-pane).

-- 
Martin Simmons
LispWorks Ltd
http://www.lispworks.com/


>>>>> On Tue, 23 Mar 2010 23:11:24 +0000, Alexandre Paes said:
> 
> Thank you so much Denis, i didn't notice layouts were subclasses of panes.
> That's what i get for not playing enough with my copy of Lispworks :P
> 
> I will try to tackle my needs with this, i'm still afraid of how this will
> behave with big datasets, running your example with 300 instances of
> 'myrecord takes about 7 seconds to display the interface.
> 
> 
> Cheers,
> 
> Alex Paes
> 
> 
> 
> On Tue, Mar 23, 2010 at 9:43 PM, Denis Pousseur <denis.pousseur@gmail.com>wrote:
> 
> >  Naturally, layout are panes : for instance pinboard-layout is a subclass
> > of output-pane and layout (You can use the Class browser if you want to have
> > an idea of classes inheritance). To scroll, simply set the init-arguments
> > horizontal-scroll and/or vertical-scroll to T when you create the instance
> > of the layout.
> >
> > With the same exemple replace the last form by this :
> >
> > (capi:contain (make-instance 'capi:row-layout :horizontal-scroll t
> > :description (loop for i from 0 to 3 collect (make-instance 'myrecord))))
> >
> > to get a horizontal scroll-bar
> >
> > Best
> >
> > Denis
> >
> >
> > Le 23/03/10 22:20, « [NOM] » <[ADRESSE]> a écrit :
> >
> > Hi Denis, thank you for your answer, i tried your example and it looks like
> > i could use this approach if it wasn't for one problem... scrolling. I tried
> > some approaches and looking into the capi reference guide i could only find
> > references to scrolling when dealing with panes. Do you have any idea if
> > it's possible to have scrolling on layouts as well?
> >
> > Cheers,
> >
> > Alex Paes
> >
> > On Tue, Mar 23, 2010 at 8:28 PM, Denis Pousseur <denis.pousseur@gmail..com>
> > wrote:
> >
> > You can also create a subclass of some type of layout. The initialize
> > instance of this new class can set the layout-description automatically as
> > you want. After that you can create a layout with some instances of this
> > new
> > class, one for each record. For instance :
> >
> > (defclass myrecord (capi:grid-layout) ())
> >
> > (defmethod initialize-instance :after ((self myrecord) &rest initargs)
> >   (declare (ignore initargs))
> >   (setf (capi:layout-description self) (loop for color in '(:red :green
> > :blue :black)
> >                                              collect (make-instance
> > 'capi:output-pane :visible-min-width 50 :visible-max-width t
> >
> > :visible-min-height 50 :visible-max-height t :background color))))
> >
> > (capi:contain (make-instance 'capi:row-layout :description (loop for i from
> > 0 to 3 collect (make-instance 'myrecord))))
> >
> > Best
> >
> > Denis
> >
> >
> > Le 23/03/10 20:56, « [NOM] » <[ADRESSE]> a écrit :
> >
> > > Hi all,
> > >
> > > I need to show a list of records where each record should show multiple
> > panes.
> > > I looked into LIST-PANEL, LIST-VIEW, MULTI-COLUMN-LIST-PANEL but none
> > seems to
> > > allow such behavior. Should I just create an interface class with the
> > desired
> > > layout and panes and then create an instance of this interface for each
> > record
> > > and add them to some layout?
> > >
> > > Thanks in advance for the help,
> > >
> > > Alex Paes
> > >
> >
> >
> > -------------------------------------------------------
> > Denis Pousseur
> > 70 rue de Wansijn
> > 1180 Bruxelles, Belgique
> >
> > Tel : 32 (0)2 219 31 09
> > Mail :  denis.pousseur@gmail.com
> > -------------------------------------------------------
> >
> >
> >
> >
> >
> >
> > -------------------------------------------------------
> > Denis Pousseur
> > 70 rue de Wansijn
> > 1180 Bruxelles, Belgique
> >
> > Tel : 32 (0)2 219 31 09
> > Mail :  denis.pousseur@gmail.com
> > -------------------------------------------------------
> >
> 


Re: Best way to compose panes

Alexandre Paes wrote on Tue, 23 Mar 2010 19:56:13 +0000 22:56:

| I need to show a list of records where each record should show multiple
| panes. I looked into LIST-PANEL, LIST-VIEW, MULTI-COLUMN-LIST-PANEL but
| none seems to allow such behavior. Should I just create an interface
| class with the desired layout and panes and then create an instance of 
| this interface for each record and add them to some layout?

Have you looked at YstokGrid? (http://lisp.ystok.ru/ygrid/)
Its new release is almost ready but testing on LW6 is on schedule.
--
Sincerely,
Dmitriy Ivanov
lisp.ystok.ru


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