Skip to content

Altering Select options dynamically #5659

@leemthai

Description

@leemthai

I wanted to add a bit of text to the currently selected Select menu item to indicate its status.

e.g. "Item 1" -> "Currently selected: Item 1"

The only way I can think of right now to achieve this is to call set_options() whenever the selected item changes. i.e. in Select.Changed

However, this has the unfortunate effect of creating some kind of infinite loop... and I can't figure out why. Maybe something to do with 'blanks' etc.

Uppdate: I just read this for set_options():
"This will reset the selection."
That sounds particularly bad for my idea. Resetting the selection when a selection has just been made..

But anyway, just wanted to know if:

  1. Calling set_options() from inside on_select_changed is allowed, generally.
  2. If there is a better way to alter the display text for the currently selected menu option?

Cheers,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions