Friday, November 6, 2015

Animated Button

Animated Button

Button တခုကို color ထည့္လိုက္ရင္ ျဖစ္ျဖစ္၊ background image ထည့္လိုက္ရင္ ျဖစ္ျဖစ္၊ အဲဒီ button ကို click တဲ့အခါ animation မရေတာ့ပဲ ပံုေသႀကီး ျဖစ္သြားပါတယ္။

အခု project မွာ button ကို click လိုက္ခ်ိန္မွာ color ေလး ေျပာင္းျပေအာင္ timer နဲ႔ animate လုပ္ျပထားပါတယ္။

ဒါကို နည္းယူၿပီး color နဲ႔ မဟုတ္ပဲ background image ေလးေျပာင္းျပေအာင္ animate လုပ္ၾကည့္ဖို႔ ေလ့က်င့္ခန္း ေပးလိုက္ပါတယ္။

=========
Views Panel
=========
ColorRelease=cYellow
ColorPress=cGreen
pressedButton=""
SetTimerInterval(100)

AddButton("btn1",10%x,10%y,80%x,10%y,"")
SetColor("btn1",20,ColorRelease)
SetText( "btn1","Click me")

=============
Events Panel
=============
Sub Activity_Pause(UserClosed)
End Sub

Sub Activity_Resume
End Sub

Sub Button_Click(who)

Timer_tick
pressedButton=who
SetTimerEnabled(true )
SetColor(pressedButton,20,ColorPress)

# MsgBox("Button clicked",who)

End Sub

Sub Timer_Tick
SetTimerEnabled( false)
SetColor(pressedButton,20,ColorRelease)
End Sub

=========

No comments:

Post a Comment