StopArrowKeyOnRow

Hi!

What is the equivalent of Grid Control's property StopArrowKeyOnRow in Grid Data Bound Grid.

Thanks,
Bits

3 Replies

AD Administrator Syncfusion Team November 7, 2006 08:39 AM UTC

Hi Bits,

Sorry for the inconvenience caused.

I couldn't see the StopArrowKeyOnRow property in a GridControl. I am really sorry to inform you that I am not clear about your question. Can you please give me a more details regarding this issue?

Do you want to customize the ArrowKey behavior in a grid? If so, you can handle the QueryNextCurrentCellPosition event and set the e.Handle to true to cancel it.

Below is a code snippet

//Cancel the all Arrow Key movement.
//If you want to cancel the Left & Right , you can check condition using the e.Direction.
private void gridQueryNextCurrentCellPosition(object sender, GridQueryNextCurrentCellPositionEventArgs e)
{ e.Handled = true; }

Refer to the forum thread below for more details.
http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=13075

Let me know if i am missing something.

Best Regards,
Haneef


AD Administrator Syncfusion Team November 7, 2006 12:32 PM UTC

Hi! Haneef,

OOPS! Sorry it was my mistake, we have a custom grid, which has this property. I thought somehow it belongs to Grid Control.

Yes, When I set WrapCellBehavior = GridWrapCellBehavior.WrapRow

I want only the Tab/Enter keys to move to the next row, while the Right Arrow key should remain/stop at the end of the enabled column and Left Arrow key should stop of the first enabled column.

Thanks,
Bits


AD Administrator Syncfusion Team November 7, 2006 01:19 PM UTC

Hi!

I found the solution. After loading the Grid.
I would find First Enabled Column and Last Enabled Column of the Grid using the below code
-------------------
Me.mintFirstEnabledColumn = 0
For Each gbCol As GridBoundColumn In Me.GridDataBoundGrid1.Binder.InternalColumns
If gbCol.StyleInfo.Enabled Then
If Me.mintFirstEnabledColumn = 0 Then Me.mintFirstEnabledColumn = Me.GridDataBoundGrid1.NameToColIndex(gbCol.MappingName)
Me.mintLastEnabledColumn = Me.GridDataBoundGrid1.NameToColIndex(gbCol.MappingName)
End If
Next
------------------------

Then in CurrentCellKeyDown Event set the e.handled = True as below.

------------
Private Sub GridDataBoundGrid1_CurrentCellKeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles GridDataBoundGrid1.CurrentCellKeyDown

If e.KeyCode = Keys.Right AndAlso Me.GridDataBoundGrid1.CurrentCell.ColIndex = Me.mintLastEnabledColumn Then
e.Handled = True
ElseIf e.KeyCode = Keys.Left AndAlso Me.GridDataBoundGrid1.CurrentCell.ColIndex = Me.mintFirstEnabledColumn Then
e.Handled = True

End If
End Sub

--------------

It worked like a Charm!

Thanks
Bits

Loader.
Up arrow icon