Any way to change Databindings with buttons / dropdowns?

Posts: 28
Title says it all- I'm looking to rework my control panel / overlays so it doesn't look like this jumbled up mess.

Any ideas? Thank you!

Posts: 28
Holy crap haha- I open up the binding and see that there's some scripts inside the labels

I'm not really good with scripting, nor with linking up these things. Any tutorial and help that I can reference? Or do I have to just look off of the example and hope I copy and paste well?
Posts: 785
The code that handles these "timing modes" looks long and complicated but once you understand it it's not too bad. Basically it boils down to:
  • The script handles both the data conversion (taking input result and outputting the desired data string) and changing the current timing mode
  • If the script is used as data conversion, then it runs the path that goes into "ConvertToGapString". Here it simply checks which mode is currently selected, and converts the input to the desired text. For most things like pitstops and laptimes that conversion is trivial. For gaps and intervals you can see how I use our own internal "gap binding converters" to do the conversion for me; you can mostly copy those.
  • If the script is used to set the current mode, then it reads the text/name of the selected item of the dropdown and uses that to determine which mode is being requested. The text should match one of the possible timing modes that are defined near the top under "TimingDisplayModes". It converts the input text to the corresponding timing mode and stores that in the TimingDisplayProvider.CurrentModeH or TimingDisplayProvider.CurrentModeV property so the conversion script can check which is the current mode.

Beyond that it is mostly about keeping track which ticker is being updated - the same script supports changing H and V ticker both to avoid duplicating code for each ticker. There is also some kind to chang the "title" or header on top of the ticker to reflect what it is currently showing.

Finally, the dropdown used to switch the mode simply executes the script whenever the selected item changes. It passes either "H" or "V" as the value to indicate which ticker you're changing. The name / text of the items, again, must correspond to the possible TimingDisplayModes.


All in all it is not trivial, but I added this to show what kind of complicated logic you can achieve with some more advanced scripting.