Skip to content

Commit 95827fa

Browse files
authored
Added traits: example to the FluidClassDefinition doc
1 parent c79b55a commit 95827fa

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

doc/FluidClassDefinition/FluidClassDefinition.md

+14-2
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,22 @@ By default, a class has a `FixedLayout` and you do not have to specify a layout.
106106
### The message `traits:`
107107

108108
In Pharo, a class can be composed out of trait composition using the message ` traits:`.
109+
For example, let's have a look into the `SpListPresenter` class that uses two traits.
109110

111+
```
112+
SpAbstractListPresenter << #SpListPresenter
113+
traits: {SpTSearchable + SpTDecoratedText};
114+
slots: {
115+
#allowToSelect => ObservableSlot .
116+
#autoDeselect => ObservableSlot .
117+
#headerTitle => ObservableSlot .
118+
#display => ObservableSlot .
119+
#icon => ObservableSlot };
120+
tag: 'Widgets-Table';
121+
package: 'Spec2-Core'
122+
```
110123

111-
112-
124+
Note that to use more that one trait, you need to send the message `+` to the trait classes.
113125

114126
### Non-default instance variables
115127

0 commit comments

Comments
 (0)