You are not logged in.
This forum has been archived and no longer accepts new user registrations. Please report your questions, problems, and feedback to the issue page of ReoGrid on GitHub. Thank you for your cooperation.
Pages: 1
Topic closed
How can override the keydown event for the Ctrl+A?
This code that overrides the control+A, but when it executes it selects the whole range of the control and not just the range i want.
Is there another way to do this or is that correct way?
Thank you,
Shane
' Initialize the flag to false.
nonNumberEntered = False
Dim range As ReoGridRange = New ReoGridRange(2, 1, 32, 2)
If e.Modifiers = Keys.Control AndAlso e.KeyCode = Keys.A Then
If rgDataGathering.Name = Me.ActiveControl.Name Then
rgDataGathering.SelectRange(range)
End If
nonNumberEntered = False
Exit Sub
End If
Last edited by asparatu (2014-08-31 01:14:51)
Offline
In 0.8.7 Ctrl+A can be prevented by BeforeCellKeyDown event:
http://reogrid.net/v0-8-7/handle-keyboard-event/
C#
var sheet = grid.CurrentWorksheet;
sheet.BeforeCellKeyDown += (ss, ee) => ee.IsCancelled = (ee.KeyCode == (Keys.Control | Keys.A));
VB
Dim sheet = grid.CurrentWorksheet
AddHandler sheet.BeforeCellKeyDown, _
Sub(ss, ee)
ee.IsCancelled = ee.KeyCode = (Keys.Control Or Keys.A)
End Sub
Last edited by Jingwood (2014-09-05 02:35:59)
Offline
Thank you, I will use the new version of ReoGrid and use the code you gave me.
I, also, assume you put this in the load event?
I also see that cancels the keypress for control key or A key, because it has an OR logic. I would assume that it would have to be ANDALSO Logic, so check to for the combination of both keys and just not one?
Shane
Last edited by asparatu (2014-09-09 02:10:00)
Offline
Yes it is in Load event. I think OR keyword is the combination, it's binary or, not logical or.
Offline
Pages: 1
Topic closed