Hi Leo,
Thanks for your interest in Syncfusion products.
Query: Does Syncfusion
keep track of user highlighted text within a cell? If, so how can I access
it? |
Yes, you can keep track of the selected text by
customizing the following events. 1.
CurrentCellStartEditing event. 2.
TextBox_MouseUp event. |
Please refer to the following code snippet and the sample
file.
Code snippet: void
gridDataBoundGrid1_CurrentCellStartEditing(object
sender, CancelEventArgs e) { GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell; if (cc.Renderer is GridTextBoxCellRenderer) { GridTextBoxCellRenderer rend = cc.Renderer as GridTextBoxCellRenderer; rend.TextBox.MouseUp += new MouseEventHandler(TextBox_MouseUp); } } Using
the mouseup event, you will get the selected text . void TextBox_MouseUp(object sender, MouseEventArgs
e) { TextBox text = sender as TextBox; if (text.SelectionLength
> 0) { Console.WriteLine(text.SelectedText); } } |
Sample file: http://www.syncfusion.com/downloads/Support/DirectTrac/99890/99890_SelectedText653111008.zip
Please let me know if you have any other concerns.
Regards,
Arun.
"
However when I look at the mainForm of the application I am working on,
I don't see the Grid element, rather I see the tools element:
"using Syncfusion.Windows.Forms.Tools;"
Should I ask my question in a different part of the forum, or does this not change anything? Sorry for the confusion.
Thanks,
Leo
Hi Leo Rakita,
Thanks for your update.
The last update of yours is un cleared for us. We can’t find
what issue you faced. If you have faced the
same issue, please provide the sample code or project file which is reproduce the
issue in your end. It will helps us to reproduce the issue and provide better
solution.
If you have any new queries, please create new forum query. Please
let me know if you have further concerns.
Vinish.
Within this if statement, I make a call to a method I am working on implementing:
String userSelectedText = mainForm._pdd.getCurrentUserSelectedText();
_pdd is an instance of PrimaryDataDisplay class which has a GridControl Element:
private Syncfusion.Windows.Forms.Grid.GridControl _gridPDD = null;In the PrimaryDataDisplay.cs class I am implementing
public String getCurrentUserSelectedText(){ // Retrieve the old and new values of a cell. GridCurrentCell cc = this._gridPDD.CurrentCell; string newValue = cc.Renderer.ControlText; string oldValue = this._gridPDD[cc.RowIndex, cc.ColIndex].Text; return newValue; }
newValue string stores the entire value within current cell (cc). Is there a way to
retrieve only the portion of text the user has selected? I don't see a method
associated with GridCurrentCell that would allow me to do that.
Thanks,
Leo
Hi Leo,
Thanks for the update.
Query: Is there a way to retrieve only the
portion of text the user has selected? |
The sample file and code I had given above itself can be
used for getting the cell partial text. I had attached two forum link’s please
refer to it and let me know if the reported behavior had been solved. |
Forum Link : http://www.syncfusion.com/support/forums/grid-windows/67771
KB link : http://www.syncfusion.com/support/kb/606
Please let me know if you have any other concerns.
Regards,
Arun.