-
Notifications
You must be signed in to change notification settings - Fork 12
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
How should PhET-iO customize text in components like ComboBoxes? #458
Comments
@pixelzoom said:
|
We previously experimented with a PhET-iO mode where objects were customized as they were created, but it was ultimately removed it because it was incompatible with subtyping. We could open a new investigation for this, or look at using query parameters (or another upstream mechanism) to accomplish this. @jonathanolson previously promoted making our UI components more mutable, and we have done that in some cases, such as changing colors. @pixelzoom said often it is simpler to dispose an entire UI component and create a new one, but @jonathanolson pointed out that can damage the state of interaction with an in-use component.
@pixelzoom also pointed out that it may be possible to change text after UI component construction as long as we correctly set
One way to change the values at the source and have the changes reflected downstream would be to model them as axon Properties. This is what we typically do for other cases. |
@pixelzoom continued:
|
I've identified the following strategies that might address this:
|
Here is a patch that demonstrates one way to accomplish strategy (1) above. It uses
It looks like this: I'd like to get initial feedback on this strategy before going further. @zepumph or @pixelzoom can you please comment? |
... which we should do because of the cost of 1-4, but won't do because we can't seem to say no. So regarding the other proposed strategies... 2 might be OK in specific cases, but it's not at all generally appropriate for MVC. 3 won't handle the case where the client wants to change text after the sim has started. For example, they start with "Mystery Liquid", then change to "Drink Mix" after the student has solved a problem. 4 is a colossal pain, and swapping out UI components creates all kinds of other problems for PhET-iO. E.g. if a ComboBox has been customized, and one of it's items changes, creating a new ComboBox requires recreating the state of the original ComboBox. So if we have to make the text changeable, then 1 is the most general approach. We'll have to convert every string that the client might want to change to a StringProperty (not a Property as stated above). And we'll have to set (and somehow test) |
@samreid said:
I'm not sure what "going further" entails. But if you're thinking of instrumenting strings in Beer's Law Lab, please don't. Beer's Law Lab is in a bad enough state now, and (imo) it's inappropriate to do further work on PhET-iO instrumentation until the PhET-iO redesign has begun, see phetsims/beers-law-lab#230. |
Did you intend to close this issue?
Exploring other strategies.
It seems appropriate to enumerate strategies and estimate their costs. Is it a foregone conclusion that the cost will be prohibitive? |
No, thanks for reopening.
Agree, it's appropriate to enumerate and estimate their cost. And my estimate was that strategies 2-4 are inappropriate, and strategy 1 will be costly. Whether the cost is prohibitive isn't my call. |
What about adding support for UPDATE:
Then changing the |
As far as I know, some scenery nodes support |
I have no idea how to continue on this issue, marking for PhET-iO meeting. It would be good to decide on a convention moving forward. Especially since recently @pixelzoom instrumented a couple of sims by controlling text like this with Properties in the model, and having the view listen to all changes (similar to (1) in #458 (comment)), but @jbphet ended up creating Properties in just one case in the view to support this in SOM, see |
This is another problem (similar to https://github.com/phetsims/studio/issues/190) that will be fixed by https://github.com/phetsims/studio/issues/192. Unmarking for phet-io meeting. We will check in on this after the other one is completed. |
I reviewed this issue as part of the ongoing PhET-iO API common code improvements, and I think we can likely close this one. @samreid @zepumph can you also take a look and close if you agree? String customization has been standardized in Studio. All sim StringProperties are now instrumented and most can be autoselected in Studio. When pedagogically relevant, we can also describe how to customize strings in examples.md. (The general pattern is already explained in phet-io-guide.md.) |
Yes thanks for reviewing this. |
From #405. One request from the design #405 (comment) was
It was noted in the design meeting:
The text was updated successfully, but these errors were encountered: