How To When The Pickerwheel Has Changed Its Value?

Does anyone know if there is a way to know when the newPickerWheel has changed its value?  I want to make visible and hide some objects based on the value of the pickerWheel.

Thanks,

Carlos

You would likely need to setup a variable that tracked the last known value and a Runtime event listener that checks the value of:

   pickerWheel:getValues()

to see if there was a change, update the last known value and then trigger some change based on your new information.

Thank you Rob, I did just that and it worked!  It might be a good idea to have a valueChanged method on the pickerWheel.

Thanks,

Carlos

[lua]

local function evaluatePickerWheel()

        local pwValue = pickerWheel:getValues()

        if pwValue[1].index ~= 1 then

            checkboxButton.isVisible = true

            pwValue = pickerWheel:getValues()

        else

            checkboxButton.isVisible = false

        end

    end

    Runtime:addEventListener( “enterFrame”, evaluatePickerWheel )

[/lua]

You would likely need to setup a variable that tracked the last known value and a Runtime event listener that checks the value of:

   pickerWheel:getValues()

to see if there was a change, update the last known value and then trigger some change based on your new information.

Thank you Rob, I did just that and it worked!  It might be a good idea to have a valueChanged method on the pickerWheel.

Thanks,

Carlos

[lua]

local function evaluatePickerWheel()

        local pwValue = pickerWheel:getValues()

        if pwValue[1].index ~= 1 then

            checkboxButton.isVisible = true

            pwValue = pickerWheel:getValues()

        else

            checkboxButton.isVisible = false

        end

    end

    Runtime:addEventListener( “enterFrame”, evaluatePickerWheel )

[/lua]