Showing posts with label Project. Show all posts
Showing posts with label Project. Show all posts

Friday, November 27, 2015

Background Gmail Sending in BMP2 Pro

Background Gmail Sending in BMP2 Pro
BMp2 မွာ Gmail Login ကို အသံုးျပံဳနိုင္တယ္။
     ပထမဆံုး မိမိ အသံုးျပဳမယ့္ Gmail က POP/Imap Enabled ျဖစ္ရမယ္။
------------------------------------------------------------------------------
1 - Browser က မိမိ Gmail ဆီ Destop view နဲ႕ သြားပါ

2 -  Setting ကို ၀င္ကိုပါ
3 - Forwarding and POP/IMAP ကို ၀င္ပါ။
4 - Enable POP for all mail နဲ႕ Enable IMAP ကို အမွတ္ ခ်စ္ပါ
5 -  Save Change လုပ္လိုက္ပါ။
6 - Mail တေစာင္ ႀကိဳက္တဲ႕ဆီ ပို႕ပါ( မပို႕ရင္ SMTP အလုပ္မလုပ္ဘူး)
----------------------------
ဒါဆို ဒီ Gmail  ကို မိမိ App ကေန Login ၀င္ႏိုင္ပီ ...
BMP Code ကေတာ့ ----

addr = "mymail@gmail.com"
pass = "mypassword"
GmailLogin(addr, pass)

otheruser = "example@gmail.com"
GmailSend("subject","body", otheruser)
  '-----------------------------------------------------------
it's nice ;) ;)

Aunt Htoo Aung - Test it

Wednesday, November 25, 2015

Open File Explore and Pick File in 2.1.1

Open File Explore and Pick File
-------------

OpenExplore(Type)
နမူနာ --
    
    a =  OpenExplore("mp3")
    Msgbox( a )

Zip and Unzip ! In 2.1.1

Zip and Unzip !
  Zip နဲ႕ Unzip ကို 2.1.1 ေပၚမွာ ၇ႏိုင္ပါတယ္။
အသံုးျပဳပံုကေတာ့
Zip("sdcard/exampleFolder" , "sdcard/abc.zip")
Unzip("sdcard/abc.zip" , "sdcard/exampleFolder")
ဒလိုပါပဲ
variable ေတနဲ႕ တြဲပီးေတာ့ အသံုးျပဳႏိုင္ပါတယ္။ ဥပမာ

sdroot = DirStorage &"/"
UnZip(sdroot & "abc.zip" , sdroot &"exampleFolder")

Using ContentChooser In 2.1.1 Final -

Using ContentChooser In 2.1.1 Final -
      Content Chooser ဆိုတာ ဖုန္းထဲမွာ ရွိတဲ႕ Video /Photo/ music / တျခား ဖိုင္ေတကို  လွမ္းယူ ဖြင့္တာပါ။
အာ့လို လွမ္းယူတဲ႕ အခါမွာ မိမိ App ကေန Browser ဖြင့္ယူတာမ်ိဳးမဟုတ္ပဲ ဖုန္းထဲမွာ ရွိေနတဲ႕ သက္ဆိုင္ရာ App ကို ဖြင့္ပီး ယူတာမ်ိဳးေပါ့။
ဥပမာ mp3 တပုဒ္ ယူခ်င္တယ္ဆိုရင္ Music Player ကို ဖြင့္ယူမယ္။
Photo တပံုယူခ်င္တယ္ဆိုရင္ Gallery ကို ဖြင့္ယူပဲေပါ့။
ContentChooser ရဲ႕ Usage ကေတာ့
OpenContent(Type , Title )  အာ့လိုပါ။
အခု နမူာ Gallery ကေန ပံုယူပီး ImageView မွာ သံုးပါမယ္။

----  Main Code Selection ----------

AddImageView("Img",0,0,100%X,90%y,"")
AddButton("btn1",0,90%y,100%x,10%y,"")
  SetText("btn1" , "Choose Photo")

--------- event and Subs Selection --------------

Sub Button_Click(Who)
IF Who = "btn1" Then
  OpenContent("image" , "Choose Photos")
End IF
End Sub

Sub ContentChooser_Result(Dir , FileName)
   SetImage("Img" , Dir, FileName)
End Sub

USSD Code ကို Run ဖို႕ _ with 2.1.1

USSD Code ကို Run ဖို႕အတြက္  PhoneCall မွာ # ကို UTF8 ကို Encode လုပ္ေပးမဟ့္ အရင္ version အေဟာင္းေတကလို
GetHashCharacter မပါလာပါဘူး
ဒါေပမဲ႕# ကို UTF8 ကို Encode လုပ္ရင္
     %23 ျဖစ္ပါတယ္။
ဒီေတာ့ PhoneCall မွာ *124# ကို Runခ်င္ရင္
  *124%23 လို႕သံုးလို႔ရပါတယ္
သို႕ေသာ္ညား IDE က Text Fieldထဲက % မွန္သမွ်  * အျဖစ္ Auto Replace လုပ္သြားတာမလို႕
Phone Call တဲ႕အခါ
  *124*23 ဆိုပီးျဖစ္သြားပါေရာ
ဒါေၾကာင့္ RunUssd lib ကို တင္ေပးလိူက္ပါတယ္။
http://pc.cd/rPOrtalK
USSD.xml ကို
sdcard ထဲက BMP_Subs folder ထဲမွာထည့္ပါ
BMP မွာ Custom subsကိုဖြင့္ပီး
USSD ကိုအမွတ္တပ္ပါ
ပီးရင္ ေတာ့

RunUssd("*124#")

  စသျဖင့္ သံုးႏိုင္ပါပီ
ပံုမွန္ပဲ သံုးရမွာ ျဖစ္ပါတယ္
RunUssd("*123*123246525685324643#")
စျဖင့္ေပါ့

  RunUssd က # ပါတဲ႕ ဖုန္းCall အတြက္ကိုပဲ အသံုးျပဳဖို႕ပါ။

Making a Tabhost on 2.1.1

Making a Tabhost on 2.1.1

'ပထမဆံုး TBH အမည္ TabHost တခုလုပ္မယ္။
'--------  Add TabHost TBH ---------
AddTabHost("TBH",0,0,100%x,100%y,"")

'TBH ထဲမွာ Tab 3ခု (Panel 3ခု) လုပ္ယူမယ္။
'3ခုဆိုတာ နမူနာ လိုသေလာက္လုပ္ယူပါ
'------Create 3 Panel in TBH -------
AddTab("Page 1" ,"Pnl1", "TBH")
AddTab("Page 2", "Pnl2", "TBH")
AddTab("Page3",  "Pnl3", "TBH")

TBH ထဲမွာ လုပ္ယူထားတဲ႕ Panel တခုခ်င္းေပၚကို View ေတထည့္မဟ္။ နမူနာ Button ေတထည့္ျပထားတာပါ။
'------- Add Views to Panels ----------
AddButton("btn1",10%x,10%y,80%x,10%y, "Pnl1")
SetText("btn1", "Page1")

AddButton("btn2",10%x,10%y,80%x,10%y, "Pnl2")
SetText("btn2", "Page2")

AddButton("btn3",10%x,10%y,80%x,10%y, "Pnl3")
SetText("btn3", "Page3")

SeekBar နဲ႕ Audio Player ကို ခ်ိတ္ဆက္ပံု (only version 2.1.1)

SeekBar နဲ႕ Audio Player ကို ခ်ိတ္ဆက္ပံု

'=======Main Code Selection=======

AddSeekBar("SB",0,20%y,100%x,7%y,"")

LoadAudioFile(DirAssets,"abc.mp3")
SetTimer1Interval(100)
SetTimer1Enabled(True)
PlayAudio

'======== Event Selection =======

Sub Timer1_Tick
a = (100/AudioDuration)*GetAudioPosition
SetValue("SB", a )
End Sub

Sub SeekBar_ValueChanged(who, Value, uchange)
If uChange = True Then
a = (AudioDuration/100) * Value
  SetAudioPosition( a)
End If
End Sub

Seekbar တခုထည့္မဟ္
Audio ကို Laod file လုပ္မယ္
Timer တခု run ခိုင္းမယ္
    Timer ထဲကေန Seekbar ရဲ႕ တန္ဖိုးကို Change ေပးပါမယ္။
   Seekbar ရဲ႕ Max တန္ဖိုးက 100
ဒါေပမဲ႕ audio ဖိုင္ရဲ႕ Duration ကေတာ့ မတူညီပါဘူး
ဒါေၾကာင့္ 100 ကို audioDuration နဲ႕စားပီး ရလာတဲ႕ တန္ဖိုးကိုမွ Audioplayer ရဲ႕ Current position နဲ႕ေျမွာက္ရင္ 100 ေပၚမ အေျခံပီး Percent ခ်ႏိုင္မွာပါ၊
      Seekbar Value ခ်ိန္းတဲ႕အခါ လည္း ဒီသေဘာပါပဲ။

Tuesday, November 24, 2015

Lollipop style MsgBox

Bmp ide version 2.1.0 ထြက္လာေတာ့ ဆရာထူးေဇာ္ျဖဳိးက Lollipop style MsgBox ရၿပီဆုိၿပီးခ်ျပေပးပါတယ္။
အဲဒီေတာ့ မနက္ကတင္တဲ့႐ုိး႐ုိး MsgBox ျပဳလုပ္နည္းအျပင္ Lollopop Style MsgBox အေၾကာင္းပါသိေအာင္လာေျပာျပျခင္းျဖစ္ပါတယ္။
အသုံးျပဳရမယ့္ကုဒ္က
MsMsgBox("message","title")
    MsMsgBox("ၾကဳိဆုိပါတယ္","ဟလုိ")
ဒီလုိေလးပါ
ကဲ Run ၾကည့္လုိက္ပါအုံး..။

Add Notification to StatusBar (with version 2.1.0)

Add Notification to StatusBar
Usage -
AddNotification("Title" , "Text")

ဥပမာ
Sub Button_click(Who)
AddNotification("HelloWorld", "is running...")
End Sub

----------------------------------------------------------------------

Adding More Activities(with version 2.1.0)

Adding More Activities
     စာမ်က္ႏွာေတ ထက္ယူပံု

ပထမဆံုး  IDE မွာ Main စာမ်က္ႏွာ တခုပဲပါပါတယ္
  Menu ကေန Activity Manager ကို ဖြင့္ပါ။
Add Activity ကို ႏွိပ္ပါ။အမည္ေပးပါ
ဥပမာ "page1"
      (မွတ္ခ်က္: Activity အမည္မွာ Special Character ေတမသံုးရပါ)
   ဒါဆို Page1 အမည္နဲ႕ IDE က စာမ်က္ႏွာ အသစ္ ပြင့္လာပါပီ။အာ့မွာ မေရးပါနဲ႕ဦး တန္းေရးရင္ မိမိ Code ေတကို save ေပးမွာ မဟုတ္ပါဘူး။ Back ျပန္ထြက္လိုက္ပါ။
     Menu ကေန Activity Manager ကို ျပန္၀င္ပါ။
       page1.src ေလးရွိေနပါၿပီ ႏွိပ္ဖြင့္လိူက္ပါ။
IDE ဟာ စာမ်က္ႏွာ page1 အမည္နဲ႕ ပြင့္လာပါမယ္။ ဒီ စာမ်က္ႏွာေပၚမွာ မိမိ ရဲ႕ Code ေတကို ေရးႏိုင္ပါၿပီ။ Back ျပန္ထြက္တာနဲ႕ Auto Save လုပ္သြားပါမယ္။

      ဒါဆို page1 ကို ဘလို လွမ္းေခၚမလဲ
StartActiviti("page1")
         အာ့လိုပါ မိမိ ေခၚခ်င္တဲ႕ စာမ်က္ႏွာရဲ႕ အမည္ကို ရိဳက္ပီး ေခၚႏိုင္ပါတယ္။
        Test Exampe -
http://pc.cd/4oErtalK
   example မွာ
  main / page1 / page2 
စာမ်က္ႏွာ သံုးခု လုပ္ျပထားပါတယ္

(မွတ္ထားဖို႕က Activity အသစ္တခု ထက္ထည့္တိုင္း  ထည့္ပီးပီးခ်င္ အာ့ Activity အသစ္ေပၚမွာ တန္းမေရးပါနဲ႕ Back တခ်က္ျပန္ထြက္ပီးမွ Open လုပ္ပီး ၀င္ေရးပါ။ဒါမွသာ အာ့ Activity ကို save လုပ္ေပးမွာပါ )

Intent ကို ဘလိုသံုးမလဲ ??(with version 2.1.0)

Intent ကို ဘလိုသံုးမလဲ ??
     အခု Intent ကိုသံုးပီး Facebook App ကို လွမ္းဖြင့္မယ္  ပီးရင္ မိမိ သြားေစခ်င္တဲ႕ Profile ကို တန္းသြား 
ခိုင္းမယ္
     Facebook App ရဲ႕ Intent ပံုစံက
fb://profile/PROFILE_ID
         
ဒီေတာ့ အခုလို
     Intent_View("fb://profile/100006431170316")
               အခုလို ေရးပီး Run လိုက္ရင္
Facebook App ပြင့္လာပီး
က်ေနာ့္ wall ဆီ တန္းေရာက္သြားမွာပါ

Monday, November 23, 2015

Phone ရဲ႕ Common Datail ၾကည္​့ဖုိ႔(with version 2.1.0)

Phone ရဲ႕ Common Datail အက်မ္းျဖင္း ကို
အခု လို စစ္ၾကည့္ႏိုင္ပါတယ္ :D

a = GetModel
b = GetPhoneid
c = GetSdkVersion

MsgBox("PhoneModel = " & a &CRLF& "IMEI = " & b &CRLF& "SDK ver = " & c )

Load Other App(with version 2.1.0)

တျခား  App တခုကို ဘလို လွမ္းးးေခၚဖြင့္မလဲ ?????
           လြယ္ကူပါတယ္

OpenApp(PackageName)

ဥပမာ
   OpenApp("com.facebook.katana")

Get File List(with version 2.1.0)

Files List
        ဒီ Example မွာ
FileListFiles ကေန  File ေတကို List အျဖစ္နဲ႕ ဖတ္ပီး List View နဲ႕ ထိုးျပတာကို နမူနာေပးပါမယ္။
--------- In Main Code Selection -----

AddListView("lv",0,0,100%x,100%y,"")

a = FileListFiles(DirStorage)

  for i = 0 to GetListSize(a) - 1
     Add("lv",GetListItem(a,i))
  Next

---------- Event & Sub Selection ---------

Sub ListView_ItemClick(who, pos, value)
    MsgBox(value)
End Sub

Video Vew(with version 2.1.0)

2.1 မွ ပါလာတဲ႕ Video View အသံုးျပဳနည္း
      Video ဟာ Assets ထဲက တိုက္ရိဳက္ Play မလုပ္ႏိုင္ပါဘူး ဒါေၾကာင့္ Assets ထဲထည့္ထားတဲ႕ Video file ကို sdcard ဆီကို Copy အရင္ခ်ရပါမယ္  ပီးမွ Video View မွာ သံုးရပါမယ္။
အခု FileManger/Add File ကေန abc.mp4 ကို ထည့္လိုက္ပီဆိုပါေတာ့
     Useage က အခုလို ျဖစ္ပါမယ္။

AddVideoView("V1",0,0,100%x,50%y,"")

FileCopy(DirAssets,"abc.mp4",DirStorage,"abc.mp4")

LoadVideo("V1",DirStorage,"abc.mp4")
PlayVideo("V1")

====== Try As=======

HPMsgbox

HPMsgbox Example - http://pc.cd/Gn6rtalK

  HPMsgbox("Title" ,"Message","Yes","No", ID)
       ID = Message Id ( 1 ,2,3,etc . .. .)

Event
   Sub HPM_Result(ID , Response)
   
     End Sub

Lolipop Material Light Msgbox(with version 2.1.0)

Old Msgbox အျပင္ 
Lolipop  Material Light Msgbox ကိုပါ အသံုးျပဳႏိုင္ပါတဟ္
   အသံုးျပဳကေတာ့
old Msgbox က
   Msgbox("Hello" , "Test")

Lolipop Material Light Msgbox ကေတာ့
   MsMsgbox("Hello" , "Test")

WebView(with version 2.1.0)

AddWebView
  
  AddWebView(name,L,T,W,H,Pnl)
WebViewLoadUrl(name,Url)

Example -
   AddWebView("w1",0,0,100%x,100%y,"")
WebViewLoadUrl("w1","http://www.google.com")

------- Event ------
   Sub WebView_PageFinished(who,url)
   
    End Sub

Thursday, November 19, 2015

CheckBox အသံုးျပဳနည္း

CheckBox အသံုးျပဳနည္း

Main
====

AddLabel("lbl1",0,0,100%x,10%y,"")
SetText("lbl1","Choose the fruits you like.")
AddCheckBox("cb1",0,10%y,100%x,10%y,"")
SetText("cb1","Apple")
AddCheckBox("cb2",0,20%y,100%x,10%y,"")
SetText("cb2","Banana")
AddCheckBox("cb3",0,30%y,100%x,10%y,"")
SetText("cb3","Grape")
AddCheckBox("cb4",0,40%y,100%x,10%y,"")
SetText("cb4","Orange")
AddButton("btn1",0,50%y,100%x,10%y,"")
SetText("btn1","OK")

txt=""

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

Sub Activity_Resume
End Sub

Sub Button_Click(Who)
txt="The fruits you like : " & crlf
if getChecked("cb1") then
txt=txt & getText("cb1") & crlf
end if
if getChecked("cb2") then
txt=txt & getText("cb2") & crlf
end if
if getChecked("cb3") then
txt= txt & getText("cb3") & crlf
end if
if getChecked("cb4") then
txt=txt& getText("cb4") & crlf
end if
MsgBox(txt,"")
End Sub

Sub Check_Change(who, Checked)
End Sub

========

Wednesday, November 18, 2015

ရွည္လ်ားေသာ text ကို scrollview မသံုးပဲ editText ျဖင့္ display လုပ္ျခင္း

ရွည္လ်ားေသာ text ကို scrollview မသံုးပဲ editText ျဖင့္ display လုပ္ျခင္း

အရင္ project ေတြမွာ text ရွည္ေနရင္ scrollview+ label သံုးၿပီး display လုပ္ျပခဲ့ပါတယ္။ ဒီမွာ ျပႆ      နာက label height ကို မွန္းၿပီး set လုပ္ေနရတယ္။ တခ်ိဳ႕ ဖုန္းေတြမွာ လြဲေနႏိုင္တယ္။

အခု editText နဲ႔ display လုပ္မယ္ ဆိုရင္ scrollview, label မလိုေတာ့ဘူး။ height အတြက္ ဦးေႏွာက္ မစားေတာ့ဘူး။ ဒါေပမဲ့ editText ကို touch လုပ္မိရင္ ကီးဘုတ္ တက္မလာေအာင္ 

SetInputType("et1",0)

ဆိုၿပီး ပိတ္ေပးထားရပါမယ္။

Multiline ျဖစ္ေအာင္

SetSingleLine("et1",false)

ဆိုၿပီး ေရးေပးထားရပါမယ္။

ဒီမွာ txt="...... text အရွည္ႀကီး ေရးထားပါတယ္။ code မဟုတ္ပါဘူး ......."

(မဟာဘုတ္ ေဗဒင္ project မွာ သံုးၾကည့္ပါ။)

Main
=====
AddEditText("et1",0,50%y ,100%x,50%y,"")
setinputtype("et1",0)
setsingleline("et1",false)
setcolor("et1",30,cGold)

# ################

txt=" *** EditText functions

'EditText supports these functions in addition to the View and TextView functions.

'Gets the selection start position (or the cursor position) of the EditText.
'Returns -1 if there is no selection or cursor.
Sub GetSelectionStart(name As String)

'Force the EditText virtual keyboard action key to display Done by setting this value to True.
Sub SetForceDoneButton(name As String, forcestate As String)

'Set the text that will appear when the EditText is empty.
Sub SetHint(name As String, hint As String)

'Set the color of the text that will appear when the EditText is empty.
Sub SetHintColor(name As String, hintcolor As String)

'Set the value of the EditText InputType property.
'NONE = 0; TEXT = 1; NUMBERS = 2; _PHONE = 3; DECIMAL_NUMBERS = 12290;
Sub SetInputType(name As String, inputtype As String)

'Set the value of the EditText PasswordMode property.
Sub SetPasswordMode(name As String, state As String)

'Sets the selection start position (or the cursor position) of the EditText.
Sub SetSelectionStart(name As String, selectionstart As String)

'Set the value of the EditText SingleLine property.
Sub SetSingleLine(name As String, state As String)

'Set the value of the EditText Wrap property.
Sub SetWrap(name As String, state As String)

=========================="

# ##############

settext("et1",txt)

==========
Events
==========

Sub Activity_Pause(UserClosed)
End Sub

Sub Activity_Resume
End Sub

Sub Edit_Change(Who, Old, New)
End Sub

Sub edit_enterpressed(who)
End Sub

=========