在Pharo画画

Edw*_*ing 5 smalltalk pharo

我想显示一个值表,并能够选择单元格.

我将如何在Pharo Smalltalk中执行此操作?我听说Morphic小部件能够做到这一点,但我仍然是Smalltalk的新手.

小智 2

我会研究 TreeModel 类的侧面示例。

我曾经这样做过:

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)).
Run Code Online (Sandbox Code Playgroud)

然后设置树根。

你是Pharo 3还是Pharo 2?这适用于 Pharo 3。

  • 太棒了!但它更像是一个花哨的列表,而不是一个网格。即您可以选择行但不能选择单元格... (3认同)