Exemple #1
0
 protected void InvokeEditComplete()
 {
     EditComplete?.Invoke(this, null);
 }
Exemple #2
0
 protected void InvokeEditComplete()
 {
     EditComplete?.Invoke(this, new EventArgs());
 }
Exemple #3
0
        public InlineEditControl(string defaultSizeString = "-0000.00")
        {
            theme        = AppContext.Theme;
            base.Visible = false;

            double pointSize = 10;

            this.Padding = new BorderDouble(3);

            numberDisplay = new TextWidget(defaultSizeString, 0, 0, pointSize, justification: Agg.Font.Justification.Center, textColor: theme.TextColor)
            {
                Visible = false,
                VAnchor = VAnchor.Bottom,
                HAnchor = HAnchor.Left,
                Text    = "0",
                AutoExpandBoundsToText = true,
            };

            this.BeforeDraw += (s, e) =>
            {
                if (s is GuiWidget widget)
                {
                    var test = true;
                    if (test)
                    {
                        // return;
                    }

                    var bounds = widget.LocalBounds;
                    e.Graphics2D.Render(new RoundedRect(bounds, 3 * GuiWidget.DeviceScale), theme.BackgroundColor.WithAlpha(200));
                }
            };

            AddChild(numberDisplay);

            numberEdit = new MHNumberEdit(0, theme, pixelWidth: numberDisplay.Width, allowNegatives: true, allowDecimals: true)
            {
                Visible          = false,
                VAnchor          = VAnchor.Bottom,
                HAnchor          = HAnchor.Left,
                SelectAllOnFocus = true,
            };
            numberEdit.ActuallNumberEdit.InternalNumberEdit.TextChanged += (s, e) =>
            {
                numberDisplay.Text = GetDisplayString == null ? "None" : GetDisplayString.Invoke(Value);
                this.OnTextChanged(e);
            };
            numberEdit.ActuallNumberEdit.InternalNumberEdit.MaxDecimalsPlaces = 2;

            numberEdit.ActuallNumberEdit.EditComplete += (s, e) =>
            {
                EditComplete?.Invoke(this, e);
                timeSinceMouseUp.Restart();
                numberEdit.Visible    = false;
                numberDisplay.Visible = true;
            };

            AddChild(numberEdit);

            VAnchor = VAnchor.Fit;
            HAnchor = HAnchor.Fit;

            runningInterval = UiThread.SetInterval(HideIfApplicable, .1);
        }
 /// <summary>
 /// This is called when the user has modified the text control.  It will
 /// be triggered when the control looses focus or enter is pressed on non-multi-line control.
 /// </summary>
 public virtual void OnEditComplete(EventArgs e)
 {
     EditComplete?.Invoke(this, e);
     textWhenGotFocus = Text;
 }
 private void internalTextEditWidget_EditComplete(object sender, EventArgs e)
 {
     EditComplete?.Invoke(this, null);
 }