Login  Register

Re: Spec: Setting rows height of a pictures list

Posted by Nicolai Hess-3-2 on Oct 31, 2016; 2:12pm
URL: https://forum.world.st/Spec-Setting-rows-height-of-a-pictures-list-tp4920861p4920887.html



2016-10-31 15:07 GMT+01:00 Matteo via Pharo-users <[hidden email]>:


---------- Weitergeleitete Nachricht ----------
From: Matteo <[hidden email]>
To: Any question about pharo is welcome <[hidden email]>
Cc: 
Date: Mon, 31 Oct 2016 15:06:27 +0100
Subject: Re: [Pharo-users] Spec: Setting rows height of a pictures list
Thanks Nicolai,

        unfortunately, even using images of the same height I obtain a list
with thin rows. Maybe I'm typing something wrong.

        I'll try to figure out how to handle this.
        Please let me know, if you have any further suggestion.

Thanks,
Matteo


For Images with the same height/width, you can use #buildWithSpecLayout: in the displayBlock and
use a SpecTableLayout with the width/height of the image model image.

But this doesn't really work, somehow the list widget can not handle the selection and scrolling (but the images are shown in full size) :

imageModels :=  (1 to:10) collect:[:i | ImageModel new image: PolymorphSystemSettings pharoLogoForm].
listModel := ListModel new items: imageModels.
listModel displayBlock:[:item | | layout |
    layout := SpecTableLayout row add:#yourself; height: item image height; width: item image width.
    item buildWithSpecLayout: layout].
listModel openWithSpec

 

On 31/10/16 12:26, Nicolai Hess wrote:
>
>
> 2016-10-31 10:19 GMT+01:00 Matteo via Pharo-users
> <[hidden email] <mailto:[hidden email]>>:
>
>
>
>     ---------- Weitergeleitete Nachricht ----------
>     From: Matteo <[hidden email] <mailto:[hidden email]>>
>     To: "Pharo is welcome (ML)" <[hidden email]
>     <mailto:[hidden email]>>
>     Cc:
>     Date: Mon, 31 Oct 2016 10:18:03 +0100
>     Subject: Spec: Setting rows height of a pictures list
>     Hi,
>             I've created a list of pictures, i.e. a widget based on
>     ListModel where
>     each item is a ImageModel.
>
>             When the widget is displayed I get list window with very
>     thin rows.
>
>             Is there a way to control the ListModel rows height?
>
>
> Not if the images have different heights (you can, but it looks
> terrible, because the underlaying list morph does not work for list
> items with different heights).
>
>
>
>
>     Thanks,
>     Matteo
>
>
>