Re: Show / Hide Tooltips
Posted: 11 September 2020, 14:22
Thanks for detailing this.quietmint wrote: ↑11 September 2020, 01:25It's stored with the other preferences, number 200. Read with: this.prefs[200]RavingWanderer wrote: ↑10 September 2020, 02:47 Two questions which are relevant to this discussion:
1. How does one interrogate (get the current value of) the BGA-supplied "Display tooltips" preference?
2. How is one notified that it has changed? (It doesn't force a refresh.)
Answers to these questions should be documented someplace (in the options file doc, game.js doc, or other place?)
Regarding updates, the framework doesn't provide a callback, so you have to add your own. Something like this can be done during the setup, connected to each of the dropdowns (remember there are two spots with the same dropdowns -- the Options tab below the game, and the top-right corner):Code: Select all
var _this = this; var updatePreference = function (e) { var match = e.target.id.match(/^preference_[cf]ontrol_(\d+)$/) if (!match) { return; } var pref = +match[1]; var prefValue = +e.target.value; _this.prefs[pref].value = prefValue; if (pref == 123) { // do something here if you care about pref #123 changing } }; dojo.query('.preference_control').connect('onchange', updatePreference);