Skip to content

Commit

Permalink
Fast setting of IP address
Browse files Browse the repository at this point in the history
Increment the address in step of 10 if the button is hold.

Signed-off-by: Stefano Babic <[email protected]>
  • Loading branch information
sbabic committed Jul 11, 2018
1 parent 689f523 commit 07802dd
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions SWUpdateGUI_ipaddress.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,26 @@ function IPAddress.new(class, self)
button = ui.Button:new(addr)

self.buttons[i] = ui.Button:new {
onClick = function(self)
val = tonumber(self.Text) + 1
incaddr = function(self, step)
val = tonumber(self.Text) + step
if (val > 255) then
val = 1
val = val % 256
end
self:setValue("Text", tostring(val))
end,
onClick = function(self)
self:incaddr(1)
--val = tonumber(self.Text) + 1
--if (val > 255) then
-- val = 1
--end
--self:setValue("Text", tostring(val))
end,
onHold = function(self)
self:incaddr(10)
end
}
}

self.buttons[i].Text= "1"
grp:addMember(self.buttons[i])
end
Expand Down

0 comments on commit 07802dd

Please sign in to comment.