Hello everyone,
You can now select single or multiple cells in FTs, for that you need to set
the selectionMode to #column
I made a short video to illustrate that: https://vimeo.com/220251050
There are a few things to note here:
- The default selection mode is set to #row.
- A reference to the fasttable needs to be passed the FTCellMorphs in the
DataSource.
- For multi-cell selection, the command key stroke on macOS is mapped to
the
Alt gr key in Windows, this doesn't seem right but this is what the "event
commandKeyPressed" returns.
You can find an example in the Examples sub package in the
Morphic-Widgets-Fasttable package: “exampleTable6”
|table ds|
ds:=FTSampleDataSource new:10.
table := FTTableMorph new
extent: 500@500;
selectionMode: #column;
addColumn: (FTColumn id: 'column1');
addColumn: (FTColumn id: 'column2');
addColumn: (FTColumn id: 'column3');
dataSource: ds;
selectRowIndex: 1;
showFirstRowSelection;
beMultipleSelection;
onAnnouncement: FTSelectionChanged
do: [ :ann | ('rows selected: ', (ann
newSelectedRowIndexes asString))
crLog ];
onAnnouncement: FTCellStrongSelectionChanged
do: [ :ann | |index morph ed |
index := ann selectedCellIndex.
morph := table visibleCellMorphAtIndex: index.
ed := RubFloatingEditorBuilder new
customizeEditorWith: [ :editor |
editor scrollbarsShowNever.
editor bounds: (morph bounds
insetBy: (Margin left: -2 top: 0 right: 0
bottom: 0 ))
];
withEditedContentsDo: [ :editedContents |
(ds elements at: index first)
instVarAt:index second put:
editedContents asString.
table refresh].
ed openEditorWithContents: ((ds elements at:
index first) instVarAt:
index second).
];
yourself.
table openInWindow.
You can load the new package either from Smalltalkhub
<http://smalltalkhub.com/#!/~ElhamerOussama/FastTableOptimizations/> or
from Github <https://github.com/SamTheDev/Morphic-Widgets-FastTable>
Your feedback is most welcome 😊
Regards,
Elhamer Oussama.
--
View this message in context:
http://forum.world.st/FTs-now-support-single-and-multi-cells-selection-tp4949553.html
Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.