Spec row height for list of custom widgets

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Spec row height for list of custom widgets

Ben Coman
I'm trying to adapt this example from the  Spec booklet...

ListPresenter  new
  displayBlock:  [  :x  |  x  buildWithSpec  ];
  items: ('Files'  asPackage  classes
    collect:  [:cls | ButtonPresenter  new  icon:  cls  systemIcon;  label:  cls  name]);
openWithSpec

to use my own presenter rather than ButtonPresenter, but it seems to be only showing the first line of my presenter.  How can the height of each list row be changed.  i.e. for the able sample code, how to make the buttons taller?

cheers -ben
Reply | Threaded
Open this post in threaded view
|

Re: Spec row height for list of custom widgets

Ben Coman
On Fri, 27 Dec 2019 at 09:17, Ben Coman <[hidden email]> wrote:
I'm trying to adapt this example from the  Spec booklet...

ListPresenter  new
  displayBlock:  [  :x  |  x  buildWithSpec  ];
  items: ('Files'  asPackage  classes
    collect:  [:cls | ButtonPresenter  new  icon:  cls  systemIcon;  label:  cls  name]);
openWithSpec

to use my own presenter rather than ButtonPresenter, but it seems to be only showing the first line of my presenter.  How can the height of each list row be changed.  i.e. for the able sample code, how to make the buttons taller?

I thought #heightToDisplayInList:  looked promising, but overriding it to force a particular value like this...
```
ButtonPresenter subclass: MyButtonPresenter 
    ...etc

MyButtonPresenter >>  heightToDisplayInList: aList
    ^200
```

then doing...
```
cls := 'Files'  asPackage  classes anyOne.
mbp := MyButtonPresenter new icon:  cls  systemIcon;  label:  cls  name.

lp := ListPresenter  new
  displayBlock:  [  :x  |  x  buildWithSpec  ];
  items: {mbp. mbp}.
lp openWithSpec.
```

didn't change the row height.

cheers -ben