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.

Row Selection moves CurrentCell to disabled column in DBG

Thread ID:

Created:

Updated:

Platform:

Replies:

7795 Oct 9,2003 11:39 AM Oct 10,2003 11:05 AM Windows Forms 5
loading
Tags: GridControl
Gene Gorokhovsky
Asked On October 9, 2003 11:39 AM

I have a databound grid, and set Style.Enabled to false (as well as ReadOnly=true, Clickable=false) in PrepareViewStyleInfo for the leftmost three columns. The result is that user cannot activate, click or edit the cells in the first three columns by clicking on them directly, or tabbing across the cells which is exactly the desired effect. However when user selects a grid row by clicking a rowheader column, the cell that gets automatically activated is in the leftmost column, something that I thought was made impossible by my PrepareViewStyleInfo code. For me the correct behavior would be to make the cell in fourth column active (or have no active cell at all) What would be the correct way to achieve the desired behavior? Thanks, Gene

Administrator [Syncfusion]
Replied On October 9, 2003 02:00 PM

Try overriding QueryCellInfo instead when setting cells read-only, disabling them etc. The reason I suggest this is that PrepareViewStyleInfo is only called just before the cell gets drawn - It's main focus is to alter visual aspects of the grid and can take view state into consideration (like position of current cell, selected cells etc.) The style is only while a cell is drawn and will immediately discarded afterwards. QueryCellInfo on the other side is being called a bit earlier. It is meant to handle the state of cells. It's state is cached in the grid and it is not meant to handle view-specific context. If that does not work. Did you override any events, e.g CurrentCellMoving and/or CurrentCellActivating? Stefan

Gene Gorokhovsky
Replied On October 10, 2003 06:06 AM

Same behavior is observed when I set the styles of the first three columns at the grid initialization tyme (i.e. when GridBoundColumns are created), and do not manipulate them dynamically. I do not override any CurrentCell* events. Gene > Try overriding QueryCellInfo instead when setting cells read-only, disabling them etc. > > The reason I suggest this is that PrepareViewStyleInfo is only called just before the cell gets drawn - It's main focus is to alter visual aspects of the grid and can take view state into consideration (like position of current cell, selected cells etc.) The style is only while a cell is drawn and will immediately discarded afterwards. > > QueryCellInfo on the other side is being called a bit earlier. It is meant to handle the state of cells. It's state is cached in the grid and it is not meant to handle view-specific context. > > If that does not work. Did you override any events, e.g CurrentCellMoving and/or CurrentCellActivating? > > Stefan >

Administrator [Syncfusion]
Replied On October 10, 2003 07:52 AM

It's the CurrentCellActivating method in GridDataBoundGrid. It calls AdjustRowHeader and after that there are no more checks if the cell is enabled or not. So, try to override protected override void AdjustRowHeader(GridCurrentCellMovingEventArgs e) { if (e.ColIndex <= 0) e.ColIndex = 3; //Model.Cols.HeaderCount+1; } Stefan

Gene Gorokhovsky
Replied On October 10, 2003 10:28 AM

I feel that this is behavior that should be adjusted in the GridDataBoundGrid itself. Do you think this will make as an enhancement/bug fix? I have made a bit more generic using the following code: protected override void AdjustRowHeader(GridCurrentCellMovingEventArgs e) { if (e.ColIndex <=0) { e.ColIndex = FindFirstEnabledColumn(); } } private int FindFirstEnabledColumn() { if (this.GridBoundColumns != null) { for (int i = 0;i < this.GridBoundColumns.Count;i++) { if (this.GridBoundColumns[i].StyleInfo.Enabled) { return i + 1 + this.Model.Cols.HeaderCount; } } } return -1; } Perhaps this could be done better to take into account unbound columns etc. Gene > It's the CurrentCellActivating method in GridDataBoundGrid. It calls AdjustRowHeader and after that there are no more checks if the cell is enabled or not. > > So, try to override > > protected override void AdjustRowHeader(GridCurrentCellMovingEventArgs e) > { > if (e.ColIndex <= 0) > e.ColIndex = 3; //Model.Cols.HeaderCount+1; > } > > > Stefan >

Administrator [Syncfusion]
Replied On October 10, 2003 11:05 AM

We'll have that fixed in 1.6.1.8 and 2.0 Stefan

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.

;