Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Draw table in Pharo

I’d like to display a table of values and be able to select cells.

How would I do this in Pharo Smalltalk? I’ve heard talk of Morphic widgets able to do this, but I’m still really new to Smalltalk.

like image 726
Edward Ocampo-Gooding Avatar asked Nov 02 '22 09:11

Edward Ocampo-Gooding


1 Answers

I would look into TreeModel class side examples.

I used to do that:

tree := TreeModel new.
tree openWithSpec.

tree columns: (Array 
    with: (TreeColumnModel new displayBlock: [:node | node content first asString ]; headerLabel: 'Name'; yourself)
    with: (TreeColumnModel new displayBlock: [:node | node content second asString ]; headerLabel: 'Last Name'; yourself)
    with: (TreeColumnModel new displayBlock: [:node | node content third asString ]; headerLabel: 'Age'; yourself)
    with: (TreeColumnModel new displayBlock: [:node | node content fourth asString ]; headerLabel: 'Gender'; yourself)).

then set the tree roots.

Are you in Pharo 3 or Pharo 2 ? This works in Pharo 3.

like image 164
Clement Bera Avatar answered Dec 24 '22 23:12

Clement Bera