Sunday, November 1, 2015

Text File Reader

Text File Reader တခု ေရးၾကမယ္

===============
Views Panel
===============

AddPanel("pnlMain",0,0,100%x,100%y,"")
AddButton("btn1",10%x,10%y,80%x,10%y,"pnlMain")
SetText("btn1","Read Text File")
Reading=false

AddPanel("pnl1",0,0,100%x,100%y,"")
SetVisible("pnl1",false)
AddscrollView("scr1",0,0,100%x,100%y,"pnl1")
getPanel("scr1","pnl2")
Setheight("pnl2",200%y)
AddLabel("lbl1",0,0,100%x,200%y,"pnl2")

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

Sub Activity_Resume
End Sub

Sub Button_Click(Who)

str=FileReadString(FileDirRootExternal,"sample.txt")
SetText("lbl1",str)
SetVisible("pnl1",true)
SetVisible("pnlMain",false)
Reading=true

End Sub

sub Activity_keypress(key)

if key=4 then
if Reading=true then

SetVisible("pnl1",false)
SetVisible("pnlMain",true)
Reading=false

else
activityfinish
end if
end if

end sub

===============

No comments:

Post a Comment