Wednesday, November 18, 2015

Image Button

ImageButton

ဒီတခါေတာ့ label + activity_touch + btn image 2 ပံုသံုးၿပီး animated imageButton ေလး ေရးပါမယ္။

အရင္ဆံုး ေအာက္က link မွာ button အစိမ္း နဲ႔ အ၀ါ ကို ေဒါင္းၿပီး btngreen.png, btnyellow.png ဆိုၿပီး rename လုပ္ထားပါ။ ၿပီးရင္ BMP မွာ add ထားပါ။

http://www.iconarchive.com/show/soft-scraps-icons-by-hopstarter/Button-Blank-Green-icon.html

Main
====

AddPanel("pnl1",0,0,100%x,100%y,"")

AddLabel("lblbtn1",10%x,10%y,80%x,20%y,"pnl1")
Bitmapinit(DirAssets,"btngreen.png")
setBackgroundimage("lblbtn1")
SetText("lblbtn1","Click Me")
SetGravity("lblbtn1",17 )
x11=10%x
x12=90%x
y11=10%y
y12=30%y

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

Sub Activity_Resume
End Sub

sub activity_touch(action,tx,ty)
   
    select action

    case 0

        if (tx>x11) then
        if (tx<x12) then
        if (ty>y11) then
        if (ty<y12) then
       
                    Bitmapinit(DirAssets,"btnyellow.png")
setBackgroundimage("lblbtn1")
            invalidate("lblbtn1")

        end if
        end if
        end if
        end if

    case 1

Bitmapinit(DirAssets,"btngreen.png")
setBackgroundimage("lblbtn1")
        invalidate("lblbtn1")
        MsgBox("You clicked the Button","")
    end select
end sub
==========

2 comments:

  1. x11=10%x
    x12=90%x
    y11=10%y
    y12=30%y
    အဲဒါေတြက ဘာေျပာတာလဲဆရာ

    ReplyDelete
  2. x11=10%x
    x12=90%x
    y11=10%y
    y12=30%y
    အဲဒါေတြက ဘာေျပာတာလဲဆရာ

    ReplyDelete