PDA

View Full Version : Updating contents of combo box



Varsuuk
June 28th, 2023, 15:56
I have a global script referenced by a ComboBox (in this case, created through RW, in case the proxy matters.) The combobox is for (base)races and is initially populated upon layout. When the value in the race box changes (onValueChanged(), it calls clear on the subraces combobox and popuates the subraces combo with corresponding subraces (sometimes, it is an empty list)

The part above seems to work.
What doesn't work, is that if I had selected a subrace previously, selecting a new race which clear()s the "linked" subrace combo does not clear the text in the visibe string for thje combobox. If I click it, I now see a different list (which does not have the old (still) visible value in it.) It might even be an empty list.

Is there an existing example of some such use of combo boxes where the current value selected on a "linked" box is changed when the "prime" choice is changed?
(or... am I using completely the wrong paradigm for selecting from preset lists of valid choices and those choices present another subset. I know in 5E when some similar "multichoices" happen, it is via a dialog that depending on selection, the followup dialog offers different choices. I'd like to do it all on one window vs popups, if this is possible.)

Varsuuk
June 28th, 2023, 16:59
Damn...

OK - sorry, it's my OLD memories of GUI coding couple decades past. Combobox isn't a "combobox" ... it's a simplestring template with "mo-di-fi-ca-tions" (sorry, flashback to "Cars", I think)
SO, once opening the TEMPLATE instead of the lua file (which I was reading for API) it hit me... umm... setValue("")? That worked, now will read the base stuff in case there is a better way - haven't tested if setting to empty string has "issues" since just got back to desk after coffee run and read a bit.

I tried subrace_combobox.setValue() [empty parens] and that worked too. I set an "empty text" string to test with and in both cases that is what it got set to. Been a while, now a reminder to myself to look past just lua files.

I later added subrace_combox.setListValue() to clear the index as well.