(phixonline)-->
-- demo\rosetta\Animation.exw
with javascript_semantics
include pGUI.e
string hw = "Hello World! "
bool direction = true
Ihandle label
function button_cb(Ihandle /*ih*/, integer /*button*/, pressed, /*x*/, /*y*/, atom /*pStatus*/)
if pressed then
direction = not direction
end if
return IUP_CONTINUE
end function
function timer_cb(Ihandle /*ih*/)
hw = iff(direction ? hw[$] & hw[1..-2]
: hw[2..$] & hw[1])
IupSetAttribute(label,"TITLE",hw)
return IUP_IGNORE
end function
procedure main()
IupOpen()
label = IupLabel(hw,`FONT="Verdana, 18"`)
IupSetCallback(label, "BUTTON_CB", Icallback("button_cb"))
Ihandle dlg = IupDialog(label,"TITLE=Animation, DIALOGFRAME=YES, CHILDOFFSET=70x40, SIZE=200x80")
IupShow(dlg)
Ihandle hTimer = IupTimer(Icallback("timer_cb"), 160)
if platform()!=JS then
IupMainLoop()
IupClose()
end if
end procedure
main()