Action Buttons

All,
Don’t know if this already exists, or is feasible, but after playing with the camera switch, from front to back and vice versa, I thought it would be nice if you could change the text on the button to reflect that. Since the text on the button is the variable used in the call it would appear not. It could be useful if you had a separate button trigger variable and a button name variable so you could switch ON to OFF etc. What do you think ?

Anyone any ideas to achieve this, other than using sprites and a class for buttons?

Is this worth expanding @Simeon? Are you planning UI revolution in 4 ? Could save some real estate in the parameter window.

You can use parameter.boolean to get a toggle-like UI (on/off). I agree though, that changing the names on the button text would be useful

Codea 4 will have a different UI and parameter mechanism

@Simeon - thanks for that, fuelling my interest in 4.

@Bri_G Do you have a small example of what you’re doing with camera buttons.

@dave1707 - no, just posted a switcher for front to back cameras in the @Creator27 's thread for switching cameras but he wanted Craft cameras not the built in one’s.

@Bri_G if I’m understanding correctly what you’re after, you could have two different functions that set up parameters, one with the button text reading one thing and one with it reading the other. Then in functionA’s button action you could clear the parameters and call functionB.

Here’s a way to do a camera action button.

function setup()
    switch() 
end

function parms()
    parameter.clear()
    parameter.action(n,switch)
    -- add any other parms here
end

function draw()
    background()
    sprite(CAMERA,WIDTH/2,HEIGHT/2)
end

function switch()
    front=not front
    if front then
        n="Back Camera"
        cameraSource(CAMERA_FRONT)
    else
        n="Front Camera"
        cameraSource(CAMERA_BACK)
    end
    parms()
end