Skip to content

Press Enter to go to the next LineEdit #7262

Answered by tronical
mehranj73 asked this question in General
Discussion options

You must be logged in to vote

You could go via the accepted callback and explicitly call focus() on the next LineEdit, like this:

import { VerticalBox, LineEdit } from "std-widgets.slint";

export component Demo {
    forward-focus: first-name;  
    VerticalBox {
        alignment: start;
        first-name := LineEdit {
            placeholder-text: "First Name";
            accepted(text) => { last-name.focus(); }
        }
        last-name := LineEdit {
            placeholder-text: "Last Name";
            accepted(text) => { age.focus(); }
        }
        age := LineEdit {
            placeholder-text: "Age";
        }
    }
}

(SlintPad Link)

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by tronical
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants