34 lines
819 B
Plaintext
34 lines
819 B
Plaintext
--
|
|
-- demo\rosetta\Animation.exw
|
|
--
|
|
include pGUI.e
|
|
|
|
string hw = "Hello World! "
|
|
bool direction = true
|
|
Ihandle label
|
|
|
|
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
|
|
|
|
function key_cb(Ihandle /*ih*/, atom c)
|
|
if c=K_ESC then return IUP_CLOSE end if
|
|
if c=K_UP then direction = not direction end if
|
|
return IUP_CONTINUE
|
|
end function
|
|
|
|
procedure main()
|
|
IupOpen()
|
|
label = IupLabel(hw,"FONT=\"Verdana, 18\"")
|
|
Ihandle dlg = IupDialog(label,"TITLE=Animation, DIALOGFRAME=YES, CHILDOFFSET=70x40, SIZE=200x80")
|
|
IupSetCallback(dlg, "K_ANY", Icallback("key_cb"))
|
|
IupShow(dlg)
|
|
Ihandle hTimer = IupTimer(Icallback("timer_cb"), 160)
|
|
IupMainLoop()
|
|
IupClose()
|
|
end procedure
|
|
|
|
main()
|