Skip to content

Instantly share code, notes, and snippets.

@ferminhg
Created December 3, 2014 08:54
Show Gist options
  • Select an option

  • Save ferminhg/c56f2ca7a870d427424d to your computer and use it in GitHub Desktop.

Select an option

Save ferminhg/c56f2ca7a870d427424d to your computer and use it in GitHub Desktop.
Corona SDK - Creating Stepper Widgets. Incremento y decremento
local widget = require("widget")
local currentNumber = 0
-- Handle stepper events
local function onStepperPress(event)
if( "increment" == event.phase ) then
currentNumber = currentNumber + 1
elseif ( "decrement" == event.phase ) then
currentNumber = currentNumber -1
end
print( currentNumber )
end
--Create the widget
local newStepper = widget.newStepper
{
left = 110,
top = 300,
minimumValue = 0,
maximumValue = 50,
onPress = onStepperPress
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment