User (Old forums)MemberNovember 24, 2008 at 11:21 amPost count: 23064
I have a panel that displays a GridControl. This grid displays two columns, the first is checkbox based and the second is just plain text. The text of the second column does not show into the panel when the grid is docked to fill, because the text is too wide and I do not want to word wrap. This is all fine and exactly as I want it.
My problem is that when the user clicks on the text of the second column, the focus moves to that column, meaning that the checkbox column disappears (to the left of the panel where it is out of sight) and the beginning of the second column moves to the far left of the panel meaning that it is the only column in view. How can I prevent the user from doing this? Please note that AllowCellNavigation = false already, so this property is oviously not relevant to my problem.
Imported from legacy forums. Posted by russellcoombes (had 763 views)User (Old forums)MemberNovember 24, 2008 at 2:56 pmPost count: 23064
It is not possible to prevent the grid from scrolling to the next scrollable column, even if it is not possible to navigate or set a cell to be the current one (the row will be set as the current one). However, a possible workaround would be to monitor if a cell from the string column is selected, and if so, set the current cell to the bool column, and bring it into view.
private void Form1_Load( object sender, EventArgs e )
new EventHandler( gridControl1_CurrentCellChanged );
void gridControl1_CurrentCellChanged( object sender, EventArgs e )
if( gridControl1.CurrentCell.ParentColumn.FieldName == “StringColumn” )
gridControl1.CurrentCell = gridControl1.CurrentCell.ParentRow.Cells[ “BoolColumn” ];
Imported from legacy forums. Posted by André (had 284 views)User (Old forums)MemberNovember 25, 2008 at 4:27 amPost count: 23064
Thanks for the prompt answer. I have tried the above in the Grid’s MouseClick and it does indeed work in putting the focus back into the CheckBox column (ie the ‘BoolColumn’). However, it leaves me with a nasty ‘flicker affect’ as the grid scrolls to bring the second column into view and then immediately returns to bring the first column back into view. I was thinking that it might be better to hide the grid during this time, as a slight flicker of the grid (ie setting Visible = false and then back to true after scrolling to column 1) would be preferable to the flicker caused by the column scrolling. Is there any event that is fired prior to the grid scrolling to another column that I might be able to capture? I could use this event to then hide the grid whilst I move the checkbox column back into view.
Imported from legacy forums. Posted by russellcoombes (had 476 views)User (Old forums)MemberNovember 25, 2008 at 11:53 amPost count: 23064
I can’t think of any event for this. However, the interesting part here, on our side, is that it does not flicker at all, it prevents the grid from scrolling altogether. So I wonder why this is not the case in your project. Are you handling other events at the same time, which requires more processing, and which would explain the flickering? Or doing something else in the CurrentCellChanged event handler?
Imported from legacy forums. Posted by André (had 1049 views)
- You must be logged in to reply to this topic.