Custom Menu
Menu key ကိုႏွိပ္လိုက္ရင္ Menu listView ေလး ေအာက္ေျခမွာ ေပၚလာေအာင္ ေရးပါမယ္။ Multiple pages နဲ႔ တြဲျပထားပါတယ္။ ဒီနည္းကို အသံုးျပဳရင္ page တခုတိုင္း အတြက္ ျခားနားတဲ့ menu ေတြကို ဖန္တီးႏိုင္ပါမယ္။
Views
=====
AddPanel("pnlMain",0,0,100%x,100%y,"")
AddPanel("pnl1",0,0,100%x,100%y,"pnlMain")
SetColor( "pnl1",0,cRed)
AddPanel("pnl2",0,0,100%x,100%y,"pnlMain")
SetColor( "pnl2",0,cYellow)
SetVisible( "pnl2",false)
AddPanel("pnl3",0,0,100%x,100%y,"pnlMain")
SetColor( "pnl3",0,cGreen)
SetVisible( "pnl3",false)
AddPanel("pnl4",0,0,100%x,100%y,"pnlMain")
SetColor( "pnl4",0,cBlue)
SetVisible( "pnl4",false)
AddPanel("pnl5",0,0,100%x,100%y,"pnlMain")
SetColor( "pnl5",0,cCyan)
SetVisible( "pnl5",false)
# ###################
AddPanel("pnlMenu",0,60%y,100%x,40%y,"pnlMain")
SetColor( "pnlMenu",0,cyellow)
AddListView("lvMenu", 0,0,100%x,40%y,"pnlMenu")
Add("lvMenu","Page 1" )
Add("lvMenu","Page 2" )
Add("lvMenu","Page 3" )
Add("lvMenu","Page 4" )
Add("lvMenu","Page 5" )
SetVisible( "pnlMenu",false)
currentpage="pnl1"
MenuVisible=false
Events
======
Sub Activity_Pause(UserClosed)
End Sub
Sub Activity_Resume
End Sub
Sub Activity_KeyPress(key)
if key=82 then
SetVisible("pnlMenu",true )
MenuVisible=true
end if
if key =4 then
if MenuVisible=true then
SetVisible("pnlMenu",false )
MenuVisible=false
else
activityfinish
end if
end if
End Sub
Sub ListView_ItemClick(who, pos, value)
select value
case "Page 1"
SetVisible( currentpage,false)
currentpage="pnl1"
SetVisible( currentpage,true)
SetVisible( "pnlMenu",false)
case "Page 2"
SetVisible( currentpage,false)
currentpage="pnl2"
SetVisible( currentpage,true)
SetVisible( "pnlMenu",false)
case "Page 3"
SetVisible( currentpage,false)
currentpage="pnl3"
SetVisible( currentpage,true)
SetVisible( "pnlMenu",false)
case "Page 4"
SetVisible( currentpage,false)
currentpage="pnl4"
SetVisible( currentpage,true)
SetVisible( "pnlMenu",false)
case "Page 5"
SetVisible( currentpage,false)
currentpage="pnl5"
SetVisible( currentpage,true)
SetVisible( "pnlMenu",false)
end select
MenuVisible=false
End Sub
========
No comments:
Post a Comment