Extend the betawidget Lua testapp:
* Be more interesting when clicking the first window * Add a timer event handler * Add a clipboard usage example git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5968 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
1eefcb27c9
commit
574a74ab35
|
@ -9,8 +9,21 @@ wnd:addEventHandler(betawidget.EVT_MOUSE_CLICK,
|
|||
return function (self, evt, handlerId)
|
||||
clicked = clicked + 1
|
||||
print(string.format("Clicked %d times", clicked))
|
||||
if (clicked % 2) == 0 then
|
||||
self:reposition(400, 50)
|
||||
else
|
||||
self:reposition(0, 0)
|
||||
end
|
||||
end
|
||||
end)()
|
||||
)
|
||||
wnd:addTimerEventHandler(betawidget.EVT_TIMER_PERSISTENT, 1000,
|
||||
(function ()
|
||||
local time = 0
|
||||
return function (self, evt, handlerId)
|
||||
time = time + 1
|
||||
print(string.format("%d seconds passed", time))
|
||||
end
|
||||
end)()
|
||||
)
|
||||
wnd:addEventHandler(betawidget.EVT_KEY_DOWN,
|
||||
|
@ -24,3 +37,6 @@ wnd2 = betawidget.window("myOtherWindow", 100, 100)
|
|||
wnd2:repositionFromAnchor(wnd, betawidget.CENTRE, 0, betawidget.MIDDLE, 0)
|
||||
print(string.format("It is: %f %f", wnd2.offset.x, wnd2.offset.y))
|
||||
wnd2:show()
|
||||
|
||||
print(string.format("The clipboard's contents are \"%s\"", betawidget.getClipboardText()))
|
||||
betawidget.setClipboardText("Hello World")
|
||||
|
|
Loading…
Reference in New Issue