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.
Syncfusion Feedback

Changing text on entering edit mode

Thread ID:

Created:

Updated:

Platform:

Replies:

46292 Jul 10,2006 04:51 PM UTC Jul 11,2006 01:24 PM UTC Windows Forms 6
loading
Tags: GridControl
Max Bolingbroke
Asked On July 10, 2006 04:51 PM UTC

Hi, We wish to implement Excel-like behaviour using the Grid control: when a user double clicks a cell to enter Edit mode, they are given an opportunity to edit the formula rather than the value that is displayed in the grid. We have attempted to work this behaviour in by handling the CurrentCellStartEditing event, and changing the value of gridControl.CurrentCell.Renderer.Control.Text to the formula. This works but breaks the selection behaviour. Thanks in advance for any help, Max

Administrator [Syncfusion]
Replied On July 10, 2006 05:41 PM UTC

Hi Max, Try setting ActivateCurrentCellBehavior property to GridCellActivateAction.DblClickOnCell to resolve this issue. Here is a code snippet. //Begin editing / focus on text box when user double clicked on cell. this.gridControl1.ActivateCurrentCellBehavior = GridCellActivateAction.DblClickOnCell; Let me know if this helps. Best Regards, Haneef

Administrator [Syncfusion]
Replied On July 10, 2006 05:43 PM UTC

If you are using our FormulaCell celltype, I think you can get this behavior by setting these properties. GridFormulaCellRenderer.ForceEditWhenActivated = false; this.gridControl1.TableStyle.CellType = "FormulaCell"; this.gridControl1.ActivateCurrentCellBehavior = GridCellActivateAction.DblClickOnCell;

Max Bolingbroke
Replied On July 11, 2006 10:50 AM UTC

>Hi Max, > >Try setting ActivateCurrentCellBehavior property to GridCellActivateAction.DblClickOnCell to resolve this issue. Here is a code snippet. Thank you, but I already have this. It is not a solution to the problem that I can''t change the text that the user gets to edit after they double click on the cell. >If you are using our FormulaCell celltype, I think you can get this behavior by setting these properties. >GridFormulaCellRenderer.ForceEditWhenActivated = false; >this.gridControl1.TableStyle.CellType = "FormulaCell"; >this.gridControl1.ActivateCurrentCellBehavior = GridCellActivateAction.DblClickOnCell; Thanks again: I tried adding the ForceEditWhenActivated line to your ForumlaCell sample and it now operates in exactly the manner I would like. However, I am using the grid in virtual mode (handing QueryCellInfo/QueryCellFormattedText) and don''t really want to use your formula engine to process the text that shows up when you go to edit. What is more, I have tried just leaving my QueryCellFormattedText as it was for a normal virtual grid (i.e. not including the functionality that the text to edit is different to that which is shown) but still enabling the FormulaCell style in QueryCellInfo: now when I go to edit a cell the edit box is blank! What changes do I need to make to offer this functionality with virtual grids and arbitrary strings to be shown to the user when they go to edit? I have attached a sample demonstrating the sort of application I am working with, with the changes you have suggested so far made to it. Max

ExcelGrid.zip

Administrator [Syncfusion]
Replied On July 11, 2006 11:35 AM UTC

Try adding a grid.CurrentCellInitializeControlText event handler and set the raw value there. void gridControl_CurrentCellInitializeControlText(object sender, GridCurrentCellInitializeControlTextEventArgs e) { e.ControlText = e.Style.Text; e.Cancel = true; }

Administrator [Syncfusion]
Replied On July 11, 2006 11:52 AM UTC

Here is your sample back with the CurrentCellInitializeControlText event added and your QueryCellInfo code commented out (works with this QueryCellInfo code in or out). http://www.syncfusion.com/forums/uploads/excelgrid.zip

Max Bolingbroke
Replied On July 11, 2006 01:24 PM UTC

Thanks a lot for the updated sample: that event was just what was needed and our issue has been resolved. Thanks again, Max

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

;