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. Image for the cookie policy date

Select a 2nd SymbolLabel

If I have a symbol with 2+ labels, how do I set the 2nd (or 3rd, etc) label into text edit mode? Or, for that matter, how do you *programatically* set any SymbolLabel (even the first) into edit mode? I.E.: I know that by moving a label up in hierarchy, when the user double clicks a symbol, the 0-indexed symbol label will enter edit mode. How do I do this programatically on any of the labels?

4 Replies

AD Administrator Syncfusion Team March 28, 2006 05:08 AM UTC

Hi, Thanks for your interest in Syncfusion. To programmatically set the text edit mode of the SymbolLabel , the ReadOnly property of the SymbolLabel would be sufficient. Kindly, refer the SymbolFactory Sample( Diagram.Windows\Samples\Symbol Design\SymbolFactory ) in particular the GenerateSymbolModelForShapes()in which the SymbolLabel can be set to text edit mode using the ReadOnly property. If the ReadOnly property is True the Label text cannot be edited and if false the Label text can be edited. Please let me know if you have any queries. Regards, Praveena.


ER Eric Robishaw March 28, 2006 04:25 PM UTC

I think you missed my point(s). 1) If there are 2 labels on a symbol, the user has no way of entering edit mode on the 2nd label. Even if it is not readonly, when dbl clicking on a symbol, only the first (index 0) label is ever entered. 2) I want to *programmatically* enter edit mode. i.e., issue a command that places any label of my choice into edit mode. > > Hi, > > Thanks for your interest in Syncfusion. > > To programmatically set the text edit mode of the SymbolLabel , the ReadOnly property of the SymbolLabel would be sufficient. > > Kindly, refer the SymbolFactory Sample( Diagram.Windows\Samples\Symbol Design\SymbolFactory ) in particular the GenerateSymbolModelForShapes()in which the SymbolLabel can be set to text edit mode using the ReadOnly property. If the ReadOnly property is True the Label text cannot be edited and if false the Label text can be edited. > > Please let me know if you have any queries. > > Regards, > Praveena. > > > >


AD Administrator Syncfusion Team March 29, 2006 09:31 AM UTC

Hi, Thanks for the update. To set the text editmode of the SymbolLabel of your choice ,please refer the following code snippet. MySymbol symbol = new MySymbol(); SymbolLabel symbollabel = new SymbolLabel(); ILabelContainer lblContainer = symbol as ILabelContainer; if (symbollabel != null && !symbollabel .ReadOnly) { if (lblContainer != null) { SizeF maxSize = lblContainer .GetLabelMaxSize(symbollabel); Control parentControl = this.diagram1.Controller.ParentControl; if (parentControl != null) { // TextEdit class implements a text box control for editing the text objects. TextEdit editCtl = new TextEdit(this.diagram1.Controller.View, maxSize, true); this.texteditor = editCtl; //Starts editing the specified node. this.texteditor.BeginEdit(symbollabel); this.texteditor.Focus(); parentControl.Refresh(); } } } Please let me know if this helps you. Regards, Praveena.


AD Administrator Syncfusion Team March 29, 2006 10:18 AM UTC

Hi, I have attached a Sample file that would implement the behaviour you have requested. Thanks for your support to Syncfusion. Please let me know if you have any further queries regarding this. Regards, Praveena.

Labels_EditMode.zip

Loader.
Live Chat Icon For mobile
Up arrow icon