Scrolling an inputfield

I want to scroll an input field, code below just watches for scroll events and calls process event on the input field then generates a new keyboard event with the correct key… this correctly moves the caret inside the input field but does not scroll the input field like really pressing the up and down keys does, whats the difference?

    #region IScrollHandler implementation

    public void OnScroll (PointerEventData eventData)
    {
        if (eventData.IsScrolling())
        {
            if (eventData.scrollDelta.y < 0)
            {
                var ev = Event.KeyboardEvent("up");
                inf.ProcessEvent(ev);

            }
            else{
                var ev = Event.KeyboardEvent("down");
                inf.ProcessEvent(ev);

            }
        }
    }
    #endregion

solution was to use reflection to call UpdateLabels() after moving the caret.

1 Like

I’d log an issue to fix that bug. If it’s needed it should be public and not require reflection.
Log it using the Unity bug reporter in the editor as an enhancement.
Nod @phil-Unity