You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a really simple question. I'd basically like a selection widget -- a bunch of vertical items with a scrollbar if there are too many. This is exactly what I get with the dropdown menu, except I don't want to be dropdown -- I want it always there.
Is this possible? If so, how?
The text was updated successfully, but these errors were encountered:
function select_from(selected, items, current_item)
map(items) do t
item = (t == selected ? fillcolor("#9ba", pad(0.5em, t)) : pad(0.5em, t))
subscribe(current_item, intent(_->t, clickable(item)))
end |> vbox |> clip(auto) |> size(10em, 22em)
end
Arguments are selected the item currently selected, items a list of items (strings) to show, and finally current_item is a signal that gets updated when the user clicks on an item.
You can make this fancy: make it possible to select multiple items, use checkboxes against each item etc...
@shashi Thanks! This does create exactly the dropdown select I'm looking for, but I'm finding the clicking doesn't change the menu (tried in Firefox and Chrome). The initial selection stays selected all the time. Any thoughts?
I assumed the right way to use this (which may be wrong), would be to something like:
mysig = Signal(0)
select = select_from(inital_item, items, mysig)
map(mysig) do current
hbox(..., select)
end
This is a great library, thanks for writing it!
I have a really simple question. I'd basically like a selection widget -- a bunch of vertical items with a scrollbar if there are too many. This is exactly what I get with the dropdown menu, except I don't want to be dropdown -- I want it always there.
Is this possible? If so, how?
The text was updated successfully, but these errors were encountered: