Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!
on arrowKey AK
switch AK
case "up"
set the backGroundPattern of grc "MRAVKA" to the id of img "antUP.png"
set the icon of btn "KOPCHE" to "antUP.png"
break
case "down"
set the backGroundPattern of grc "MRAVKA" to the id of img "antDN.png"
set the icon of btn "KOPCHE" to "antDN.png"
break
case "left"
set the backGroundPattern of grc "MRAVKA" to the id of img "antLF.png"
set the icon of btn "KOPCHE" to "antLF.png"
break
case "right"
set the backGroundPattern of grc "MRAVKA" to the id of img "antRT.png"
set the icon of btn "KOPCHE" to "antRT.png"
break
end switch
end arrowKey
which is "all very charming" until you realise why I spent 10 minutes cursing Marduk . . .
To set the backGroundPattern of a graphic one uses: to the id of img "WhatDyeCallit.png"
But to set the icon of a button uses: to "WhatDyeCallit.png"
without pointing out that "WhatDyeCallit.png" is an image.
on arrowKey AK
switch AK
case "up"; put the id of img "antUP.png" into N; break
case "down"; put the id of img "antDN.png" into N; break
case "left"; put the id of img "antLF.png" into N; break
case "right"; put the id of img "antRT.png" into N; break
end switch
set the backGroundPattern of grc "MRAVKA" to N
set the icon of btn "KOPCHE" to N
end arrowKey
This is both inconsistent, and because everywhere else images are referred to as images
counter intuitive.
Yes, but pattern is pattern and icon is icon
Your students can see the difference between them and choose the better control to build what they want.
Best
Jean-Marc