WinForm controls in GoView

Hi all,

This is the code of my personal GoText class (questions are at the bottom of the page) Smile

[code]
public class MyGoTextEditor : GoText
{
private string m_DataType = “Int32”;
private GoControl m_GoControl = null;

public MyGoTextEditor(string dataType)
{
    m_DataType = dataType != null ? dataType : "Int32";
    m_GoControl = new GoControl();
}

public override GoControl CreateEditor(GoView view)
{
    if (m_DataType == "DateTime")
    {
        m_GoControl.ControlType = typeof(DateTimePicker);
        m_GoControl.Bounds = new RectangleF(this.Location, new SizeF(200, 20));

        DateTimePicker dtp = (DateTimePicker)m_GoControl.GetControl(view);
        dtp.Format = DateTimePickerFormat.Long;
        dtp.ShowUpDown = false;

        return m_GoControl;
    }
    else if (m_DataType == "Int32")
    {
        m_GoControl.ControlType = typeof(NumericUpDown);
        m_GoControl.Bounds = new RectangleF(this.Location, new SizeF(200, 20));

        NumericUpDown nud = (NumericUpDown)m_GoControl.GetControl(view);
        nud.Minimum = -2147483648;
        nud.Maximum = 2147483647;
        nud.DecimalPlaces = 0;

        return m_GoControl;
    }

    m_GoControl = base.CreateEditor(view);
    return m_GoControl;
}

public override void DoEndEdit(GoView view)
{
    if (m_DataType == "DateTime")
    {
        DateTimePicker dtp = (DateTimePicker)m_GoControl.GetControl(view);
    }
    else if (m_DataType == "Int32")
    {
        NumericUpDown nud = (NumericUpDown)m_GoControl.GetControl(view);
    }
    else
    {
        base.DoEndEdit(view);
    }
}

}
[/code]

Several questions :

  • the CreateEditor works well, but when I select a date in my DateTimePicker, my Editor doesn’t close itself and it doesn’t enter in [code]DoEndEdit[\CODE].
  • when I am editing the node and I click somewhere else in GoView, the Editor disappeared and I can’t edit my node again Confused.
  • when I am editing the node, the Editor opens at the MiddleCenter of the MyGoTextEditor which is in a MiddleCentered GoGroup (GoImage + MyGoTextEditor)… why ? I want to open the Editor to mask the MyGoTextEditor…

Thanks for your support…

Jake, we have sent an email to Scott Smith to purchase GoDiagram Win Pro

Be sure to order the support/subscription, we consider answering questions here in the forum to be part of "support".
I'll answer your questions in a bit...

You need to handle ProcessDialogKey and OnLeave in your Control class. Look at what RichText and RectWithCheckBox do in Demo1.