Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Way to switch to first option as default #247

Closed
djsegal opened this issue Aug 15, 2018 · 4 comments
Closed

Way to switch to first option as default #247

djsegal opened this issue Aug 15, 2018 · 4 comments

Comments

@djsegal
Copy link

djsegal commented Aug 15, 2018

Don't know when this got changed, but now the middle value is the default for select boxes.

Is there a way to revert to the original first-value default?

image

@piever
Copy link
Collaborator

piever commented Aug 15, 2018

You have the value and index keyword to set either the value (say "B_0", "I_P", etc...) or the index (1,2,3...) of the selected option. So in your case:

togglebuttons(["a", "b", "c"], index = 1)

Note that widgets can be used in a @manipulate, for example:

@manipulate for x in togglebuttons(["a", "b", "c"], index = 1, label = "xvar") ...

The default value is taken from InteractNext. To be honest I'm not sure what's best, whether the first or the median element, using the first is definitely more consistent with other widgets, maybe I should change that.

@djsegal
Copy link
Author

djsegal commented Aug 15, 2018

Would it just require adding index=1 to the following lines?


Also, are there other base configurations the way bulma/native html is set up?

settheme!(:nativehtml)
settheme!(:bulma)

This might be a good one to have?


edit: piggybacking on this idea, other possibilities are:

  • Button Color Scheme
  • Size of Buttons (these ones seem smaller than before?)
  • Margins between things

i.e.

settheme!(:bulma, button_size=:large, button_color=:blue)

@piever
Copy link
Collaborator

piever commented Aug 15, 2018

The default for togglebuttons is here. I think if we change it we should change it here and I'm in favor of changing as it is the only "option widget" that starts with medianelement rather than first. Technically it is a breaking change though so I would prefer to do it in the Julia 0.7 transition to minimize breakage.

Styling is awful in the notebook (maybe some bad interference between the notebook style and bulma style? not sure how to fixit): buttons look quite good in atom or blink. This is somewhat off-topic and we should maybe discuss it in a separate issue, but you can use the className attribute to add style (for example button(className ="is-large is-danger")). Somehow we should allow the user to pass a custom dictionary mapping widgets to classes, or custom css: feel free to comment at JuliaGizmos/InteractBase.jl#17 if you have usability ideas!

@piever
Copy link
Collaborator

piever commented Aug 19, 2018

closed by JuliaGizmos/InteractBase.jl#90

@piever piever closed this as completed Aug 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants