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

Exporting and Importing Multi-choosers #162

Closed
stevebhall opened this issue Oct 25, 2017 · 6 comments
Closed

Exporting and Importing Multi-choosers #162

stevebhall opened this issue Oct 25, 2017 · 6 comments

Comments

@stevebhall
Copy link

I'm using NetLogo 5.3.1

I see in the documentation that multi-chooser strings should export and import correctly but I can't seem to get them to do that for me.

I can see that the selected-item is correctly written out in the JSON (e.g.,

"roe_maxAnticipatory-1": {
"COLOR": 58,
"ENABLED?": true,
"FONT-COLOR": 0,
"FONT-SIZE": 12,
"HEIGHT": 50,
"HIDDEN?": false,
"ITEMS": [
"None",
"Psych-1",
"Psych-2",
"Psych-3",
"Pain-1",
"Pain-2",
"Pain-3",
"Lethal"
],
"KEY": "roe_maxAnticipatory-1",
"KIND": "CHOOSER",
"LABEL": "Max Anticipatory",
"OPAQUE?": true,
"SELECTED-ITEM": "Lethal",
"TAB": "ROE",
"WIDTH": 125,
"X": 1105,
"Y": 290
},

But when its imported the selected-value remains the first option.

Is this a bug or am I doing something wrong?

@nicolaspayette
Copy link
Member

Is this a bug or am I doing something wrong?

Thanks for reporting. It certainly looks like a bug.

I tried to poke around and find a possible cause, but I haven't touched that code base in a while and need to get myself reacquainted with it.

I'll probably start by tackling the long overdue #155, though. Would you consider moving to NetLogo 6.x if I get xw working in it?

@stevebhall
Copy link
Author

stevebhall commented Nov 1, 2017 via email

nicolaspayette added a commit that referenced this issue Nov 11, 2017
This fixes a bug where lists of strings where exported without quotes,
but it seems like that's something that was only occuring with NL 6.0.2,
and thus not the source of #162.
nicolaspayette added a commit that referenced this issue Nov 11, 2017
It seems like the values *do* get set correctly on import,
they're just not showing in the swing widgets.
nicolaspayette added a commit that referenced this issue Nov 11, 2017
When importing from JSON, in the case of choosers, the selected item(s)
was/where set before the actual items, and thus ignored by the Swing
widget. This makes sure that  the default property (which is usually the
main setter) gets set last.
@nicolaspayette
Copy link
Member

@stevebhall, thanks for the good words about xw's usefulness. :-)

I have upgraded the extension to work with NetLogo 6.0.2 and, hopefully, to fix the initialization of (multi-)chooser values on import.

I'd be grateful if you could give it a spin and tell me if it works for you:
https://github.com/CRESS-Surrey/eXtraWidgets/releases/tag/v2.0.0-BETA2

@stevebhall
Copy link
Author

stevebhall commented Nov 11, 2017 via email

@stevebhall
Copy link
Author

stevebhall commented Nov 13, 2017 via email

@nicolaspayette
Copy link
Member

xw save and load function is working great. Hurray!

Hurray indeed! And thanks for reporting and testing.

The xw ‘buttons', which use to have, by default, this beautiful gray shading on them, now appear solid white.

Thanks for reporting this too! I think this might be a new incarnation of #144, and I have moved the discussion there.

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