I have a TFNCGrid where I need to be able to select multiple rows using only the touch screen/mouse (no keyboard). I am using TTMSFNCGridSelectionMode.smDisjunctRow
The manual says to select multiple rows to press the Ctrl key. Touch screens do not have a Ctrl key.
Also, When the form first opens I do not want any rows selected. Then the user can touch each row in order to select it.
Also, This grid uses a DB adapter, so after the user selects the desired rows, they will press a button, then I need to be able to find those rows in the connected data table.
I have played with the SelectionMode and OnSelectCell and OnSelectedCell events but cannot get the behavior I want.
Disjunct row selection relies on the keyboard, therefore this is not optimized for touch screens.
We'll add this on our feature request list for consideration. A possible workaround would be to implement the OnMouseDown event, and use the following code:
procedure TForm1.TMSFNCGrid1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Single);
TMSFNCGrid1.SelectCell(TMSFNCGrid1.XYToCell(X, Y), [ssCtrl]);
I couldn't get that to work right. When I select the second item it unselected the first.
I have I idea, in the OnSelectedCell event I'll use code to synchronize the database with the ACol and ARow. Then I'll extract and save the ticket number from the data table. Then in the OnGetCellLayout I'll color the Fill with a "selected" color.
I feel like I'm doing more that what is needed.
It only works when Editing.Enabled = True, and the clicked column is not ReadOnly.
It works when Editing.Enabled = False only if you click on fixed columns.
We'll see if we can add touch-friendly multi - selection.
Here are some settings to describe how I am using for this situation.
- TFNCGrid with the database adapter
- I create the columns manually
- I use HTMLTemplate for some columns
- Selection mode is RowSelect
- Grid is read only (it is used for selecting the restaurant orders that need to be dispatched with a delivery driver.) Editing.Enabled = false
- There is only one fixed header row, no fixed columns
Thank you for your help on this. I have been updating our point of sale software using the latest Delphi and upgrading components, replacing the Infopower grid with the FNCGrid.
Thanks for the additional info!