Edward Ocampo-Gooding
Edward Ocampo-Gooding

Reputation: 2872

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.

Upvotes: 5

Views: 904

Answers (1)

Clement Bera
Clement Bera

Reputation: 76

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.

Upvotes: 2

Related Questions