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.
Unfortunately, activation email could not send to your email. Please try again.

StopArrowKeyOnRow

Thread ID:

Created:

Updated:

Platform:

Replies:

51483 Nov 7,2006 01:04 AM Nov 7,2006 08:19 AM Windows Forms 3
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On November 7, 2006 01:04 AM

Hi!

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

Thanks,
Bits

Administrator [Syncfusion]
Replied On November 7, 2006 03:39 AM

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

Administrator [Syncfusion]
Replied On November 7, 2006 07:32 AM

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

Administrator [Syncfusion]
Replied On November 7, 2006 08:19 AM

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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;