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: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Inplace RichTextCell

Thread ID:





28090 Apr 23,2005 01:14 PM UTC Apr 25,2005 03:50 PM UTC WinForms 7
Tags: GridControl
Asked On April 23, 2005 01:14 PM UTC

Hi, I am using the InPlaceRichTextCell downloaded from sysnfusion with whicg i am facing a problem in the GridAwareTextBox, the change in the text is not reflected in the GridAwareTextBox. How do reflect a change made in the richtextcell in the GridAwareTextBox. Regards Vinay

Administrator [Syncfusion]
Replied On April 23, 2005 03:59 PM UTC

Are you using our 3.0 release? I could see the problem you described there but not in the release. Here is a sample with the inplace cell control modified so changes to a cell are reflected in the GridAwaretextBox. A ConttrolText property overrdie was added, and the OnSavedChanges was tweaked. http://www.syncfusion.com/Support/user/uploads/RichTextInPlaceCellContol_6ec52b32.zip This only handles moving changes from the grid cell up into the text box. It does not move changes in the textbox done into the grid for this InPlace cell. If you need this, then I think listenening to a textbox changed event and explicitly setting teh changed text into the inpplace grid cell would be necessary.

Replied On April 25, 2005 08:39 AM UTC

Hi, Thanks, for the help. It works fine but when i press escape the gridaware textbox displays the RTF string. Regards Vinay

Administrator [Syncfusion]
Replied On April 25, 2005 09:49 AM UTC

Try adding this override to the renderer class.
protected override bool ProcessKeyEventArgs(ref Message m)
	if(m.Msg == 0x100)// (WM_KEYDOWN)
		Keys keyCode = (Keys)((int)m.WParam) & Keys.KeyCode;
		if(keyCode == Keys.Escape)
			return true;
	return base.ProcessKeyEventArgs (ref m);

Replied On April 25, 2005 10:10 AM UTC

Hi, I tried it, bit it still doesnt seem to work. Another problem is when i am trying to autoresize the cell while editing the text being typed is not being displayed on the screen. Regards Vinay

Administrator [Syncfusion]
Replied On April 25, 2005 10:36 AM UTC

Three things for the escape problem. One, set isModified to false in the ProcessKeyEventArgs override after cancelling the edit and before returning true. this.CurrentCell.CancelEdit(); this.CurrentCell.IsModified = false; return true; Two, add a GetFormattedText override to the cell model class.
public override string GetFormattedText(GridStyleInfo style, object value, int textInfo)
	rtb.Rtf = style.Text;
	return rtb.Text;
Three, add a grid.CurrentCellRejectedChanges event handler to your form code, and explcitly set the GridAwareTextBox value there.
private void gridControl1_CurrentCellRejectedChanges(object sender, EventArgs e)
	GridCurrentCell cc = this.gridControl1.CurrentCell;
	this.gridAwareTextBox1.Text = this.gridControl1[cc.RowIndex, cc.ColIndex].FormattedText;
Before you try to autosize the cell, try calling grid.CurrentCell.EndEdit to see if that makes things work OK. If not, can you explain how you are trying to autosize the cell (say for a menu item or are youtrying to do it dynamically woith each keystroke or ???)? Can you post a sample showing the problem?

Replied On April 25, 2005 03:24 PM UTC

Hi, I implemented the 3 steps suggested by you. The Gridawaretextbox text is being replaced in the currentcellrejectchanges event but it is again being replaced by the RTF text for some reason. About the autoresize, i have set the styleinfo autosize to true. I want the cell to be resized as the text is being typed. You can use the same sample u have provided in this thread. Please set the Autosize of the RichText cells to true in the form code. Regards Vinay

Administrator [Syncfusion]
Replied On April 25, 2005 03:50 PM UTC

Here is a sample with the esc seeming to work for me. http://www.syncfusion.com/Support/user/uploads/RichTextInPlaceCellContol_705e4f8a.zip The problem may have to to with the order in which event handlers are processed. If that is teh case, you would have instead of listening to teh CurrentCellRejected changes event, you would need to derive the grid and override OnCurrentCellRejectedChanges, calling the baseclass, and then executing the code in your event handler. This way, your code would always be hit last. As far as the auto size goes, it will take some time to work through the details of supporting autosizing on a key by key basis. You can check out how we handle it in the GridTextBoxCellRenderer and try to use something similar in your custom cell renderer.


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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