Hi there,
Does the RadioMenu command from the REPL.TerminalMenus module have an argument that allows, for convenience, to have the default pre-selected option different from the first one? I mean something like:
orange
> apple
grape
instead of:
> orange
apple
grape
Thanks
Yes, if you’re using Julia 1.6 or later.
julia> using REPL.TerminalMenus
help?> request
search: request
request(m::AbstractMenu; cursor=1)
Display the menu and enter interactive mode. cursor indicates the item number
used for the initial cursor position. cursor can be either an Int or a
RefValue{Int}. The latter is useful for observation and control of the cursor
position from the outside.
Returns selected(m).
│ Julia 1.6
│
│ The cursor argument requires Julia 1.6 or later.
─────────────────────────────────────────────────────────────────────────────────
request([term,] msg::AbstractString, m::AbstractMenu)
Shorthand for println(msg); request(m).
julia> r = RadioMenu(["orange", "apple", "grape"]);
julia> request(r, cursor = 2)
orange
> apple
grape