FTs now support single and multi-cells selection

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

FTs now support single and multi-cells selection

Elhamer
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 or from Github
Your feedback is most welcome 😊
Regards,
Elhamer Oussama.
Reply | Threaded
Open this post in threaded view
|

Re: FTs now support single and multi-cells selection

Stephan Eggermont-3
Nice. That looks like we are getting ready to add inline editable
table-based views to our browsers. That should work well with Cucumber
style tests with examples.

Stephan