Slide menu တခု ေရးၾကမယ္
phone ရဲ့ menu button ကို ႏွိပ္လိုက္ရင္ menu panel ေလး တခု ဘယ္ဘက္က ေလွ်ာၿပီး ထြက္လာေအာင္ လုပ္ပါမယ္။ menu button ကို ထပ္ႏွိပ္ရင္၊ ဒါမွ မဟုတ္ back button ကို ႏွိပ္လိုက္ရင္၊ menu item တခုကို ႏွိပ္လိုက္ရင္ ျပန္ပိတ္သြားေအာင္ ေရးပါမယ္။ menu panel ထြက္လာခ်ိန္မွာ main panel ကို ညာဘက္ကို တြန္းထုတ္သြားမွာပါ။
========
View Panel
=========
x1=-50%x
SetTimerInterval(1)
hidden=true
AddPanel("pnl1",0,0,100%x,100%y,"")
AddLabel("lbl",0,0,100%x,100%y,"pnl1")
SetText("lbl","This is main activity")
AddPanel("pnl2",x1,0,50%x,100%y,"")
SetColor( "pnl2",0,cblue)
AddButton("btn1",22,160,266,119,"pnl2")
SetText( "btn1","Menu 1")
AddButton("btn2",29,310,258,106,"pnl2")
SetText( "btn2","Menu 2")
AddButton("btn3",36,450,254,117,"pnl2")
SetText( "btn3","Menu 3")
=============
Events Panel
=============
Sub Activity_Pause(UserClosed)
End Sub
Sub Activity_Resume
End Sub
sub activity_keypress(key)
if key=4 then
if hidden=false then
SetTimerEnabled(true)
else
activityfinish
end if
end if
if key=82 then
SetTimerEnabled(true)
end if
end sub
Sub Timer_Tick
if hidden=true then
x1=x1+10
if x1>=0 then
x1=0
hidden=false
SetTimerEnabled(false )
end if
else
x1=x1-10
if x1<=-50%x then
x1=-50%x
hidden=true
SetTimerEnabled(false)
end if
end if
Setleft("pnl2",x1)
Setleft("pnl1",x1+50%x)
End Sub
Sub Button_Click(Who)
MsgBox("Menu Button clicked","")
SetTimerEnabled( true)
End Sub
===========
No comments:
Post a Comment