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

Updating listbox values with new .listbox() method does not seem to work #446

Closed
EddyBag42 opened this Issue Apr 29, 2018 · 3 comments

Comments

Projects
None yet
2 participants
@EddyBag42

EddyBag42 commented Apr 29, 2018

Simplifications of upcoming appJar v1.0 are already available in 0.92 so i began to test them. They are a considerable improvement of appJar in my opinion, and I'm very interested in using appJar v1.0 with my students. So first of all i want to thank you for your great job !
I wanted to tell you that I noticed that updating values of a list box in v1.0 style, with some instruction like app.listbox('mylistbox', mylistofvalues), does not yet work as it should (it does nothing at all). For now it seems to me that you have to stick to the "old way", that is app.updateListBox('mylistbox', mylistofvalues).
Hope this helps though it's a really tiny bug (more an occasion to thank you than anything else ;-)).

@jarvisteach

This comment has been minimized.

Owner

jarvisteach commented Apr 29, 2018

Thanks for the comments!

At the moment, I think all of the list style widgets (option, list & spin) are set to select the parameter received when an already existing widget is referenced.

I remember trying to decide what was best here - what is the most common use case. I came to the conclusion that it would be selecting an item, rather than updating the whole list.

And, as the listbox supports multi-select, it will accept a list of values to select.

So, first there should be an error I assume none of the items in your new list were in your old list - appJar should warn you about this.

And, second, there should be some way to specify to update/append/select items in the list...

jarvisteach added a commit that referenced this issue Apr 29, 2018

@EddyBag42

This comment has been minimized.

EddyBag42 commented Apr 29, 2018

Ok ! I saw in your code that the behavior was selecting but i didn't think enough about it to understand why ... Now i do ;-)

You're right, none of the items in the new list where in the old list, but as old list was an empty list this didn't throw any error ...

I really liked the design choice you made deciding app.widget('label') would be a getter and app.widget('label',values) would be a constructor/setter. In fact I liked it so much that i didn't understand until now that some widgets were not following this rule, like listboxes ... Another example with listboxes is that, to follow this rule, app.listbox('mylistbox') should not return selection as it does now (being equivalent to app.getListBox('mylistbox')) but the complete values list used to build the listbox (like app.getAllListItems('mylistbox')).

You're right, there should be some way to specify to update/append/select items in the list, and it's clearly not such a simple question to decide which would be the most natural and simple way to get it done ...

jarvisteach added a commit that referenced this issue May 5, 2018

Better listbox validation
Improved validation on selecting items in listbox #446 - displays
warning and returns success/failure boolean

jarvisteach added a commit that referenced this issue May 5, 2018

Updated simpleAppJar docs
In response to #446 docs have been updated.
@jarvisteach

This comment has been minimized.

Owner

jarvisteach commented May 5, 2018

OK, I've introduced more error checking on the listbox, so hopefully you'll now get messages when strange things happen. I've also updated the docs to make it more clear.

I'm going to close this issue, and open a new one to discuss implementing the different changing features...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment