vvvv / VL.StandardLibs

A collection of standard libraries for vvvv including VL.Stride, VL.Skia, VL.ImGui, msgpack.org[VL]
https://visualprogramming.net
GNU Lesser General Public License v3.0
35 stars 14 forks source link

Input (String) doesn't bang after latest changes #3

Closed antongit closed 1 year ago

antongit commented 1 year ago

Sebastian, we've changed the Input (Text) to hold its lastframeValue like this:

string lastframeValue;

internal override void UpdateCore(Context context)
{
    var value = Update() ?? string.Empty;
    if (ImGuiNET.ImGui.InputTextWithHint(Context.GetLabel(this, Label), Hint ?? string.Empty, ref value, (uint)MaxLength, Flags) && value != lastframeValue)
        Channel.EnsureValue(value);
    lastframeValue = value;
    }

But now the node's Bang output doesn't bang, because the Value of the ChannelWidget is not called anymore.

        public T? Value
        {
            get => value;
            protected set
            {
                this.value = value;
                Bang = true;
                if (Channel.IsValid())
                    Channel.Value = value!;
            }
        }

Should we return to Value = value, still leaving check for the lastframeValue?

    if (ImGuiNET.ImGui.InputTextWithHint(Context.GetLabel(this, Label), Hint ?? string.Empty, ref value, (uint)MaxLength, Flags) && value != lastframeValue)
        Value = value;
    lastframeValue = value;

?