Skip to content

Add auto selector widget

Choose a tag to compare

@andycate andycate released this 02 Mar 06:07
f5ffed3

This update adds a selector widget and corresponding Kotlin API. Example:

Robot.kt

import org.team5499.dashboard.StringChooser

class Robot : TimedRobot(0.005) {
    val chooser: StringChooser
    var inlineId: Int
    var concurrentId: Int
    
    init {
        chooser = StringChooser("SOME_VARIABLE", "default option", "first option",
                                                                   "second option",
                                                                   "default option",
                                                                   "another option")
        inlineId = chooser.addInlineListener() {
            key: String, value: Any? ->
            println("$key: $value")
        }

        concurrentId = chooser.addVarListener() {
            key: String, value: Any? ->
            println("$key: $value")
        }
    }

    fun robotPeriodic() {
        Dashboard.update()
        chooser.runIfUpdate() {
            key: String, value: Any? ->
            println("$key: $value")
        }
    }
}