• ¡Welcome to Square Theme!
  • This news are in header template.
  • Please ignore this message.
مهمان عزیز خوش‌آمدید. ورود عضــویت


امتیاز موضوع:
  • 310 رای - 1.88 میانگین
  • 1
  • 2
  • 3
  • 4
  • 5
Title: اموزش برنامه نویسی اندروید به همراه تمامی ابزارها
حالت خطی
(10-11-2013، 01:46 AM)'wikiccu' نوشته:
کد پی‌اچ‌پی:
Sub Process_Globals
    Dim tmrAnimation 
As Timer
    Dim currentPanelBeforePaused 
As Int
End Sub

Sub Globals
    Dim sd 
As SlidingData 'The object that holds the data for SlidingPanels
    Dim btnLeft, btnRight As Button
    Dim startX, startY As Float
    Dim SlidingDuration As Int
    SlidingDuration = 500
End Sub

Sub Activity_Create(FirstTime As Boolean)
    '
Create the panels.
    
'In this example we are just creating 8 "dummy" panels with different colors.
    '
You can instead load a different layout to each panel.
    
Dim panels(3) As Panel
    
For 0 To panels.Length 1
        panels
(i).Initialize("panels")
        
panels(i).Color Colors.RGB(Rnd(0255), Rnd(0255), Rnd(0255))
        
Dim lbl As Label
        lbl
.Initialize("")
        
lbl.Text "I'm Panel: " i
        lbl
.TextSize 20
        lbl
.TextColor Colors.White
        panels
(i).AddView(lbl20%x40%y60%x30dip)
        
Activity.AddView(panels(i), 100%x0100%x100%60dip'add the panel to the layout
        Activity.AddMenuItem("Panel #" & i, "Menu")
    Next
    '
add the Left and Right button
    btnLeft
.Initialize("Left")
    
btnLeft.Text "Left"
    
Activity.AddView(btnLeft10%x100%55dip100dip50dip)
    
btnRight.Initialize("Right")
    
btnRight.Text "Right"
    
Activity.AddView(btnRight60%x100%55dip100dip50dip)
    
    
'*****************************
    '
Initialize the SlidingData object and set the array of panels.
    
'Then we call SlidingPanels.Initialize to prepare the animation objects.
    '
The last call to ChangePanel brings the first panel.
    
sd.Initialize
    sd
.panels panels
    SlidingPanels
.Initialize(sdSlidingDuration)
    
sd.targetPanel = -1
    sd
.currentPanel currentPanelBeforePaused 1
    ChangePanel
(True'Current code expects the first call to be with Left = True.

End Sub
Sub Menu_Click
Log("menu_click")
    Dim menu As String
    menu = Sender
    btnLeft.Enabled = False
    btnRight.Enabled = False
    JumpToPanel(menu.SubString("Panel #".Length))
End Sub

Sub Left_Click
    ChangePanel(True)
End Sub

Sub Right_Click
    ChangePanel(False)
End Sub
'
**** These two subs are requred for handling the sliding ***
Sub ChangePanel(Left As Boolean)
    
'disable the buttons during the animation
    btnLeft.Enabled = False
    btnRight.Enabled = False
    '
Call SlidingPanels.ChangePanel to actually change the panels.
    
SlidingPanels.ChangePanel(sdLeft)
End Sub
Sub Animation1_AnimationEnd
    
'This event is raised when the animation finishes. You should call SlidingPanels.AnimationEnd from this sub.
    SlidingPanels.AnimationEnd(sd)
    If sd.targetPanel >= 0 Then 
        tmrAnimation.Enabled = True
        Return '
we are still animating...
    
End If
    
'Enable the Left and Right buttons (unless there are no more panels).
    '
If sd.currentPanel sd.panels.Length 1 Then btnLeft.Enabled False Else btnLeft.Enabled True
    
'If sd.currentPanel = 0 Then btnRight.Enabled = False Else btnRight.Enabled = True
    btnLeft.Enabled = True
    btnRight.Enabled = True
End Sub
Sub tmrAnimation_Tick
    tmrAnimation.Enabled = False
    ContinueJumping
End Sub
'
JumpToPanel can be used to navigate to a different panel which is not adjacent to the current one.
Sub JumpToPanel (Target As Int)
    
sd.targetPanel Target
    
For 0 To 1
        sd
.leftAnimations(i).Duration SlidingDuration 2
        sd
.rightAnimations(i).Duration SlidingDuration 2
    Next
    ContinueJumping
End Sub
Sub ContinueJumping
    
If sd.targetPanel OR sd.targetPanel sd.currentPanel Then 
        sd
.targetPanel = -1
        Animation1_AnimationEnd
        
For 0 To 1
            sd
.leftAnimations(i).Duration SlidingDuration
            sd
.rightAnimations(i).Duration SlidingDuration
        Next
        
Return
    
End If
    
SlidingPanels.ChangePanel(sdsd.targetPanel sd.currentPanel)
End Sub
Sub Panels_Touch 
(Action As IntAs FloatAs Float)
    
Select Action
        
Case Activity.ACTION_DOWN
            startX 
X
            startY 
Y
        
Case Activity.ACTION_UP
            
If Abs(startY) > 20%y Then Return
            If 
startX 30%AND btnRight.Enabled True Then 
                ChangePanel
(False)
            Else If 
startX 30%AND btnLeft.Enabled True Then
                ChangePanel
(True)
            
End If
    
End Select
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause 
(UserClosed As Boolean)
    If 
UserClosed False Then
        currentPanelBeforePaused 
sd.currentPanel
    
Else 
        
currentPanelBeforePaused 0
    End 
If
End Sub 
درود بیکران بر مهندسان
میخواستم ببینم میشه به جای کد نویسی توی این کد از Designer استفاده کرد ؟
واضح تر بگم مبشه به جای لود کردن پنل توی دیزانر این کارو بکنم و به کد آسیبی نرسه و درست اجرا بشه؟
اگه آره چطوری؟

 

 

فعلا تا اخرین نسخه basic4andriod امکانش نیست


 
گروه دور همی پارسی کدرز
https://t.me/joinchat/GxVRww3ykLynHFsdCvb7eg
 
پاسخ
  


پیام‌های این موضوع
تصویر زمینه زنده - توسط hamedbarca - 09-20-2012، 01:46 PM
RE: تصویر زمینه زنده - توسط Amin_Mansouri - 09-23-2012، 04:20 PM
نرم افزار رویال آندروید - توسط mgf1390 - 10-18-2012، 06:03 PM
RE: اموزش برنامه نویسی اندروید به همراه تمامی ابزارها - توسط Amin_Mansouri - 10-15-2013، 10:49 AM

موضوعات مشابه ...
موضوع نویسنده پاسخ بازدید آخرین ارسال
  عدم نمایش پیامک ارسالی از یک شماره خاص در اینباکس و نمایش فقط در برنامه hosseinrp 0 3,797 01-21-2016، 07:57 PM
آخرین ارسال: hosseinrp
  درست کردن بیشتر از یک Layout در برنامه Morteza_rk 6 11,685 12-09-2015، 08:18 AM
آخرین ارسال: Amin_Mansouri
  کتابخانه ی پرداخت درون برنامه ای(کویک لرن) 5225morteza 5 16,268 08-05-2015، 08:48 PM
آخرین ارسال: Amin_Mansouri
  کد ussd رو بیسیک 4 اندروید قبول نمی کنه!! اکبری 1 5,629 07-01-2015، 09:47 PM
آخرین ارسال: Amin_Mansouri
  نمایش پنجره شناور روی سایر برنامه ها mokhtarabadi 0 3,348 04-21-2015، 09:56 AM
آخرین ارسال: mokhtarabadi
Music تنظیمات اولیه برنامه BASIC 4 ANDROID arash872 3 8,089 03-18-2015، 08:36 AM
آخرین ارسال: Amin_Mansouri
  دانلود کتابساز اندروید و منتظر همکاری دوستان اندرویدی omid_student 5 12,658 01-21-2015، 02:36 PM
آخرین ارسال: shima12
  پنهان کردن سورس برنامه porya 1 4,321 11-23-2014، 09:02 AM
آخرین ارسال: Amin_Mansouri
  برنامه نویسی حرفه ای به زبان Basic4Android mohammad-alone 46 61,067 10-27-2014، 10:25 AM
آخرین ارسال: tanhae
  مشکل با دریافت توسط بلوتوث در بیسیک4 اندروید esmaeil57 2 5,143 10-25-2014، 08:56 PM
آخرین ارسال: a.mehran

پرش به انجمن:


Browsing: 21 مهمان