We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Capture right click in cell when text selected

In my virtual grid, I would like to handle a right mouse click on a cell. I do get the CellClick event (then look for if right button was clicked), but only if the cell is not already selected. If the user is already editing a cell (text in the cell may or may not be selected), how can I get a (right) mouse click event? Thanks !

8 Replies

AD Administrator Syncfusion Team September 23, 2004 02:45 PM UTC

Hi Dan, try to get a hold of the control inside the cell, e.g. Control c = grid.CellRenderers["TextBox"].Control; Once you have that control you can subscribe to its MouseDown event. Stefan


DA Dan September 23, 2004 07:36 PM UTC

Thanks Stephan. So would I have to do that for all cells in the grid? Yikes, hope not. Maybe I''ll try subscribing to the event on the "current" cell when the selection selection changes.


AD Administrator Syncfusion Team September 23, 2004 08:50 PM UTC

For each renderer in the CellRenderers collection only for the cell types you use. Typically that will only be a TextBox and ComboBox. The renderer is shared among cells ... But the best idea might be to handle the CurrentCellStartEditing and CurrentCellEndEditingComplete / CurrentCellEndEditingFailed events and subscribe/unsubscribe there from CurrentCell.Renderer.Control. Stefan


DA Dan September 27, 2004 02:38 PM UTC

I think I have the correct "Renderer" class, but the OnClick event is protected. In the help, it mentions "... is called from GridSelectCellsMouseController ... How would I get that? I''m trying this: GridTextBoxCellRenderer r = grid.CellRenderers["TextBox"] as GridTextBoxCellRenderer; Or...GridTextBoxControl class in help seems to have all the right events (mostly inherited from Control base class), but not sure how to get that either.


AD Administrator Syncfusion Team September 27, 2004 02:40 PM UTC

A renderer has a Control property which gives you access to the TextBox that is displayed in a TextBoxCellRenderer. TextBox has a public Click event. GridTextBoxCellRenderer r = grid.CellRenderers["TextBox"] as GridTextBoxCellRenderer; r.Control.Click += ... Stefan


DA Dan September 27, 2004 03:41 PM UTC

Thanks Stephan. ...but the Control value is null. (Why I didn''t think that was it before posting the last message) r.Control is null this is in the same setup function where I''m hooking up the rest of my virtual grid events.


AD Administrator Syncfusion Team September 27, 2004 05:23 PM UTC

Here is a little sample that uses CurrentCellGotFocus and CurrentCellLostFocus to subscribe to the cell control''s MouseUp event. I think you should be able to do something similar for the MouseDown. http://www.syncfusion.com/support/user/uploads/contextmenus.zip


AD Administrator Syncfusion Team June 26, 2009 04:34 PM UTC

Am I the only one noticing that all of the KB links in these forums are dead since the website got revamped. e.g., see last post before mine; 404 error.
I often get some kind of "Parse error" on trying to get to links on older posts, too.

Loader.
Live Chat Icon For mobile
Up arrow icon