GoDiagram Win Reference
CreateEditor Method (GoText)

This creates a GoControl that will create a TextBox, a ComboBox, or a NumericUpDown when the GoControl is painted in a GoView.
Syntax
'Declaration
 
Public Overrides Function CreateEditor( _
   ByVal view As GoView _
) As GoControl
public override GoControl CreateEditor( 
   GoView view
)

Parameters

view
Remarks

This is responsible for creating a GoControl with the appropriate ControlType and bounds. This method is called by DoBeginEdit. If you want to set some properties on the Control created by the GoControl for a GoView, it is probably easiest to override the DoBeginEdit method.

For more general customization you will define a subclass of Control and override this method as follows: public override GoControl CreateEditor(GoView view) { GoControl editor = base.CreateEditor(view); if (editor != null) editor.ControlType = typeof(MyCustomControl); return editor; } You may also want to adjust the Bounds of the resulting GoControl.

Your subclass of Control, MyCustomControl, which should implement the IGoControlObject interface, should be responsible for initializing itself correctly for this GoText object. That initialization is normally done when IGoControlObject.GoControl is set. It will of course want to examine this GoText object being edited; you can get that with the following expression: this.GoControl.EditedObject as GoText

When your Control is finished editing, it may want to save its results by modifying this GoText object. In particular, if you want to change the Text property, it is best to do something like: GoControl goctrl = this.GoControl; if (goctrl != null) { GoText gotext = goctrl.EditedObject as GoText; if (gotext == null || gotext.DoEdit(this.GoView, gotext.Text, newtextvalue)) { goctrl.DoEndEdit(this.GoView); } } This calls DoEdit which permits validation using both the old and the proposed new text strings, before actually setting the Text property.

Your IGoControlObjectControl should terminate by calling: this.GoControl.DoEndEdit(this.GoView) in its event handlers that cause it to finish.

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

GoText Class
GoText Members
Base Implementation in CreateEditor

 

 


© 2015. Northwoods Software Corporation. All Rights Reserved.

Send Feedback