BMP IDE နဲ႔ Sliding Panel တခု ေရးျပထားပါတယ္။ Drag လုပ္ၾကည့္ႏိုင္ပါတယ္။ :)
===============
Main
===============
in=0-windowwidth/2+50
Visible=50
pwidth=windowwidth/2
AddPanel("pnl1",in,0,pwidth,windowheight,"")
SetColor("pnl1",0,cyellow )
AddLabel("lbl1",10,100,300,100,"pnl1")
SetText("lbl1","Sliding Panel")
AddButton("btn1",10,200,300,100,"pnl1")
SetText("btn1","Click me")
dx=0
dy=0
draggable=false
oldl=in
newl=0
AddLabel("lbl2",287,495,348,217,"")
SetText("lbl2","Label in main activity")
AddButton("btn2",287,205,307,124,"")
SetText("btn2","Click me")
===============
Events
===============
Sub Activity_Pause(UserClosed)
End Sub
Sub Activity_Resume
End Sub
sub activity_touch(action,tx,ty)
select action
case 0
if tx< Visible then
draggable=true
dx=tx
end if
case 1
draggable=false
case 2
if draggable=true then
oldl=getleft("pnl1")
newl=oldl+tx-dx
if newl>0 then
newl=0
end if
if newl<in then
newl=in
end if
Visible=pwidth-newl
Setleft("pnl1",newl)
end if
end select
end sub
Sub Button_Click(Who)
select who
case "btn1"
MsgBox("You clicked the Button in sliding Panel","")
case "btn2"
MsgBox("You clicked the Button in main activity","")
end select
End Sub
==================
No comments:
Post a Comment