ETO Gridview - Possible to Select Range of Cells?

Does the Gridview allow selection of a range of cells without limiting you to a range of rows?

What I want to do:
Screenshot (126)
and
Screenshot (125)

What I seem to be limited to (to the point of all of the relevant properties and names being literally named for the purpose of dealing with a row as a unit):
Screenshot (127)

This is a really common use case and I’ve never seen a grid control that didn’t allow it (Microsoft’s, lots of third party grids over the years), so I hope I’m just missing something. I think I’ve looked everywhere (Eto docs, here- zero forum hits for ‘select range’, even the Eto group’s full application for accounting which I was certain would at least do it even if it didn’t show me how)

(screenshots actually from Excel)

Hi @Nathan_Bossett ,
That was a very intresting question.
This is a possible approach, you’d have to manage the stylings and item bindings, however I was able to make a nice proof of concept for you.

Preview:

import Rhino
import Eto.Forms as forms
import Eto.Drawing as drawing

def on_cell_click(sender, e):
    cell = sender
    if cell.BackgroundColor == drawing.Colors.Blue:
        cell.BackgroundColor = drawing.Colors.White
    else:
        cell.BackgroundColor = drawing.Colors.Blue
def RunCommand():
    dialog = forms.Dialog[bool]()
    dialog.Title = "Custom TableLayout Example"
    
    table = forms.TableLayout()
    table.Spacing = drawing.Size(5, 5)
    
    for i in range(10):  # 10 rows
        row = []
        for j in range(3):  # 3 columns
            cell = forms.TextBox(Text="Row %d Col %d" % (i, j))
            cell.MouseUp += on_cell_click
            row.append(cell)
        table.Rows.Add(forms.TableRow(*row))
    dialog.Content = table
    dialog.ClientSize = drawing.Size(400, 400)
    dialog.ShowModal(Rhino.UI.RhinoEtoApp.MainWindow)


if __name__ == "__main__":
    RunCommand()

I had to get creative, however I believe this approach is the simplest to reach that goal.
If you want to create an even closer rappresentation, you can use the draw properties and generate elements that resemble the OG datagrid, but I think my proof of concept is similar enough and will suffice.

Hope that helps as always if you have any doubts dm me,
Farouk

So you built a new grid control. I like it!

Thanks. Looks like there’s some more bookkeeping to track on columns and rows but I like the outline.

What I have at the moment is a workaround involving a context menu because my application is quite specific about the table layout. I’ll ask some users (after I recruit them :slight_smile: ) about whether it’s worth building a custom control because in my use case they almost certainly have a hand on the mouse already. I do prefer to use existing UI controls where possible.

Hi @Nathan_Bossett, just to confirm that Eto’s TreeGridView/GridView do not support this feature, nor will they likely be able to as it is not available on Mac.

Cheers,
Curtis.

Thank you!

I think there may be some ways to build it using Eto- I’ll think about it.