Hi,
When I run my app for the first time, the first row of the grid is highlighted. I'm trying to display a right click context menu in the grid MouseDown event and need to determine if I have multiple rows selected or one row selected. When I right click, it shows the ActiveRow is set to the first row, but Selected is false. I've looked around and can't find a good explanation of active row vs selected row. Can you explain the difference? When I first display the grid, do i need to set Selected = true for the first row? Does setting Selected to true also set the row as the ActiveRow?
thanks
Mario
Hello Mario,
On initializing of the 'WinGrid' control, you will have by default one ActiveRow(index 0) and zero selected.
The difference between those two is that you can have one active row at a time and many selected rows. I do not know your final goal but I guess that it should be better if you are showing this context menu through checking the active row.
Selecting a row does not mean that it will become active.
Please feel free to let me know if a question about our toolset comes up on your mind.
Hi Boris,
I have a read only grid that can have one or more rows selected. When I display the right click context menu, a couple of the menu options are different depending on whether one row is selected or multiple rows are selected, so I really need to check the Count of selected rows. I'm guessing I should set the ActiveRow (index 0) to be selected on initialization since it is misleading to the user that it is highlighted.
Thanks
Hi Mario,
Making the ActiveRow also selected is one way to deal with this. Another would be to simply check the grid.Selected.Rows.Count and if it's 0, fall back to using the ActiveRow.