Hi
I have an UltraGrid with some columns allowed for editing and others not. I need to get such behaviour so when user clicks on editable cell it is not only enters edit mode but the row also become selected. In terms of using .CellClickAction I can reach only one of them in the same time. Is there any solution?
Thank you in advance
Thank you for your response you've answered all my questions.
I don't use ActiveRow because user can select single row (which also will be ActiveRow) and then deselect it with CTRL key so I will have no selected rows at all (both in fact and for the context menu purposes)
You cannot have multiple selected rows when a cell is in edit mode. Once a cell enters edit mode, all selected rows and cells are cleared. There is no way around that.
Why don't you simply use the ActiveRow if there are no selected rows?
Andrey Chaplygin said:Right now if some rows are selected, user hold CTRL and leftclick on any editable cell the selection is cleared completely.
This sounds like something you are doing in your code. If you left-click on a cell while the CTRL key is down, the cell will not enter edit mode - it will be selected instead. If it's entering edit mode in your case, then your code must be calling PerformAction and forcing it into edit mode. If you want to check the state of the Ctrl or Shift key, you can use the Control.ModifierKeys property.
Hi Boris
In context menu Opening event I would like to check two points for example: whether any row is selected in grid and whether there are one or many selected rows (assume I would like to choose proper text for context menu item 'Remove Selected Row' or 'Remove Selected Rows'). If user entered edit mode on cell and then invokes context menu I prefer to show him 'Remove Selected Row' (though Grid.Rows.Selected.Count returns zero).
Also I would like to implement several row selection behavior with CTRL and SHIFT even if user click on editable cell. Right now if some rows are selected, user hold CTRL and leftclick on any editable cell the selection is cleared completely. I'm trying to implement it by checking whether user holds CTRL or SHIFT while leftclicking on cell in ClickCell event. And that was my original question: is there any way to achieve such behavior using grid, column or cell properties?
Regards
Hello Andrey,
You could then use the 'ClickCell' in order to get the cell and then .Column from it. I hope that I got your scenario right. Another approach would be to handle to 'MouseEnterElement' event, but I think it would be harder. Please let me know if you feel that I misunderstood you.
Hello Boris thank you for the quick response.
Yes I know about column level settings.
Assume I have a context menu and some of it's items should be visible only if any row is selected.
User click on cell end enters edit mode. Then he invokes context menu. He is still in grid he is editing particular row but since the .Selected.Rows.Count equals to zero he is unable to perform some actions with this row from context menu.
Thanks