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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Enter/Tab to next row

Thread ID:

Created:

Updated:

Platform:

Replies:

2817 Feb 14,2003 03:16 PM UTC May 28,2018 12:59 PM UTC WinForms 13
loading
Tags: GridControl
Bruce Onder
Asked On February 14, 2003 03:16 PM UTC

Is there a simple way to enable the TAB and/or ENTER key to wrap around from the last column of the current row to the first column of the next row? And vice versa?

Administrator [Syncfusion]
Replied On February 14, 2003 03:41 PM UTC

Try Grid.Model.Options.WrapCellBehavior = = GridWrapCellBehavior.WrapRow; or Grid.Model.Options.WrapCell = true; Stefan

Bruce Onder
Replied On February 14, 2003 03:59 PM UTC

Wow, what a terrific object model -- I was presuming I'd have to trap a cell change event, see if I was on the last column and moving "right" and then increment the row, etc. But noooo -- set a property and you're ready to rock! :) Thanks! --Bruce

Bruce Onder
Replied On February 17, 2003 03:12 AM UTC

Hmm. the behavior seems to work if I'm not doing anything special, but if I try to apply conditional enable/disable on columns in the PrepareViewStylesInfo event, the wrapbehavior seems to be overridden in some way. Here's some sample code. The commented code seems to prevent the wrap behavior: Private Sub grdLineItems_PrepareViewStyleInfo(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventArgs) Handles grdLineItems.PrepareViewStyleInfo Dim iColIndex As OrderItemColumns = CType(e.ColIndex, OrderItemColumns) If (e.RowIndex > grdLineItems.Model.Rows.HeaderCount) Then Select Case iColIndex Case OrderItemColumns.LineSequenceNumber If (e.Style.CellType = "Image") AndAlso (e.RowIndex < grdLineItems.Model.RowCount) Then e.Style.ImageIndex = GetImageIndex(e.RowIndex - 1) End If 'Case OrderItemColumns.CaseQuantityOrdered ' Dim bEnabled As Boolean = (Not grdLineItems.Item(e.RowIndex, OrderItemColumns.ProductNumber).Text = "") ' e.Style.Enabled = bEnabled ' e.Style.BackColor = CType(IIf(bEnabled, m_EnabledBackColor, m_DisabledBackColor), Color) 'Case OrderItemColumns.EachQuantityOrdered ' Dim bEnabled As Boolean = (Not grdLineItems.Item(e.RowIndex, OrderItemColumns.ProductNumber).Text = "") ' Dim txtValue As String = grdLineItems.Item(e.RowIndex, OrderItemColumns.WillBreakFlag).Text ' bEnabled = bEnabled AndAlso (txtValue.ToLower() = "true") ' e.Style.Enabled = bEnabled ' e.Style.BackColor = CType(IIf(bEnabled, m_EnabledBackColor, m_DisabledBackColor), Color) End Select End If End Sub The commented-out column checks are the last two columns displayed in my grid. If I apply a global enabled=false to the EachQuantityOrdered column (the rightmost column), then the CaseQuantityOrdered column (second rightmost) then correctly controls the wrap behavior. However, if I apply the conditional code in PrepareViewStyleInfo, then even when the EachQuantityOrdered column is enabled, the wrap behavior does not work (WrapRow). Any thoughts on this? --Bruce

Administrator [Syncfusion]
Replied On February 17, 2003 09:26 AM UTC

The PrepareViewStyleInfo event should only be used for setting style properties used in the drawing of the cell. This event is fired only immediately before the cell is drawn. If you need to dynamically set a style property that needs to be passed to other events such as moving the current cell code, then you should handle the QueryCellInfo event and set the style there. QueryCellInfo is the event that is fired anytime the style is required (not just when the cell is drawn).

Administrator [Syncfusion]
Replied On February 17, 2003 09:49 AM UTC

Actually, the PrepareViewStyleInfo should be fine for this scenario. But I remember we fixed some issues with WrapCell in the latest patches. We will update also the eval later this week to version 1.5.1.6 and you should give it a try then. If you continue to have problems, just send a small sample project. Stefan

Bruce Onder
Replied On February 17, 2003 02:04 PM UTC

Will this be available as a patch, or as a full new eval download?

Administrator [Syncfusion]
Replied On February 17, 2003 04:30 PM UTC

The eval will only be available as full download, not patch. Stefan

James Gramosli NO LONGER WITH COMPANY
Replied On December 20, 2007 05:21 PM UTC

Whats the latest with this option? I'm using Essential Studio 5.2.0.25 and it doesnt seem to work in that version.

How can I allow tabs to run through the grid rows?


Administrator [Syncfusion]
Replied On December 21, 2007 10:20 AM UTC

This gridControl1.Model.Options.WrapCellBehavior = GridWrapCellBehavior.WrapRow property should work OK in a GridControl or a GridDataBoundGrid for most situations. The only situation that we know about where this property does not work as expected is when the last column has disabled cells. In such a case, you would then have to handle the QueryNextCurrentCellPosition which allows you to control exactly how the tabbing works.




WindowsApplication1.zip

James Gramosli NO LONGER WITH COMPANY
Replied On December 21, 2007 01:16 PM UTC

We are using the Syncfusion.Windows.Forms.Grid.Grouping.GridGroupingControl in hierarchy mode with a DataSet and Relationships.

The last column is an unbound column which is a push button, it is set to readonly but not to Enabled=false. Should it still work for us?


Administrator [Syncfusion]
Replied On December 24, 2007 07:31 PM UTC

There is no property setting that will control tabbing to the next record in the setup you described.

The reason is that the next row in the grid may be a summary row or a nested child table or something else (ie, the grid does not just hold simple records). You would have to catch the tab key and manage moving the current cell according to how you want things to work in this situation. For exampe, if your user tabs into a collapsed child table, it it automatically expand, or should the child table be skipped and the next visible record made current (skipping any summary, footnotes, etc)? In this case, to catch the tab key, you can handle the TableControlCurrentCellKeyDown event.


raman
Replied On May 26, 2018 07:19 AM UTC

This is working fine.If we press enter focus moves to next column and in last column on pressing enter focus moves to next row first column.
If we want to skip readonly columns .

Col1                          Col2                    Col3
Readonly False     Readonly True      ReadonlyFalse

On Pressing enter from col1 focus should be on col3.

And if Col 3 readonly also true then foucs should be in next row, first cell.

Thanks & Regards

Sindhu Nagarajan [Syncfusion]
Replied On May 28, 2018 12:59 PM UTC

Hi Raman, 

Thanks for contacting Syncfusion support. 

We are able to understand your scenario. We have prepared a simple sample as per your requirement. In the sample, customizations are done in the KeyDown event. Current cell is set to the column next to the Read-Only column by using CurrentCell.MoveTo()  method. Please refer to the below code and sample, 
 
Code Example 
//Event Subscription 
gridControl1.KeyDown += GridControl1_KeyDown; 
 
//Event Handling 
private void GridControl1_KeyDown(object sender, KeyEventArgs e) 
{ 
    if (e.Modifiers == Keys.None && e.KeyCode == Keys.Tab) 
    { 
        var cc = gridControl1.CurrentCell;               
        while (gridControl1[cc.RowIndex,cc.ColIndex + 1].ReadOnly) 
        { 
            //To increment rowIndex when last column is made as Read-Only 
            if (cc.ColIndex+1 >= gridControl1.ColCount) 
            { 
                cc.MoveTo(cc.RowIndex + 1, 0); 
            } 
            else 
                cc.MoveTo(cc.RowIndex, cc.ColIndex + 1); 
        } 
    }            
} 


Please let us know if you have any other queries. 

Regards, 
Sindhu  


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.

Warning Icon 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.Close Icon

;