48 lines
930 B
Plaintext
48 lines
930 B
Plaintext
try destroydialog animGUI catch ()
|
|
|
|
global userDirection = "right"
|
|
|
|
fn reverseStr str: direction: =
|
|
(
|
|
local lastChar = str[str.count]
|
|
local firstChar = str[1]
|
|
local newStr = ""
|
|
local dir
|
|
|
|
if direction == unsupplied then dir = "left" else dir = direction
|
|
|
|
case dir of
|
|
(
|
|
"right": (newstr = lastChar + (substring str 1 (str.count-1)))
|
|
"left": (newstr = (substring str 2 (str.count))+firstChar)
|
|
)
|
|
|
|
return newstr
|
|
)
|
|
|
|
rollout animGUI "Hello World" width:200
|
|
(
|
|
button switchToLeft "<--" pos:[40,0] height:15
|
|
label HelloWorldLabel "Hello World! " pos:[80,0]
|
|
button switchToRight "-->" pos:[150,0] height:15
|
|
|
|
timer activeTimer interval:70 active:true
|
|
|
|
on activeTimer tick do
|
|
(
|
|
HelloWorldLabel.text = reverseStr str:(HelloWorldLabel.text) direction:userDirection
|
|
)
|
|
|
|
on switchToLeft pressed do
|
|
(
|
|
userDirection = "left"
|
|
)
|
|
|
|
on switchToRight pressed do
|
|
(
|
|
userDirection = "right"
|
|
)
|
|
)
|
|
|
|
createdialog animGUI
|