Android Question Can't disable button

danijel

Active Member
Licensed User
Longtime User
I hope I can explain my problem.
Simplified version:
I have 2 buttons
Button1 - Loads web page and after that do some operations on existing views..
Button2 - Do some stuff

When button1 is clicked i want to completely disable button2 while button1 working his job

I tried with panel over button to catch the event, i tried to disable button, tried to hide button.
Nothing works.
When button1 finish his work button2 is trigger anyway. (if I am clicking on button2 while button1 working his job)

Thank you guys
 

Attachments

  • test.zip
    7.2 KB · Views: 167
  • screen_record.zip
    87.4 KB · Views: 157

DonManfred

Expert
Licensed User
Longtime User
From changed test.zip project

B4X:
Sub Btn_Load_WebPage_Click
  
    Btn_Action.Enabled=False
    Pnl_Loading.Visible=True
    Pnl_Loading.BringToFront
    Counter_Click=0
    Btn_Action.Text="Action Clicked " & Counter_Click & " times"
    Sleep(200)
    Dim j As HttpJob
    j.Initialize("", Me) 'name is empty as it is no longer needed
    j.Download("https://www.b4x.com/")
          
    Wait For (j) JobDone(j As HttpJob)
    If j.Success Then
        'Do some staff...
        Dim a=0 As Int
        For i=0 To 4000000
            If i Mod 5000 = 1 Then Sleep(10)
            a=a+Sqrt(Rnd(0,10))
        Next
    Else
        Log(j.ErrorMessage)
        ' Use log or use asyncdialogs
      
        'Msgbox(j.ErrorMessage,"Error")
    End If
    j.Release
    Sleep(200)
    Pnl_Loading.Visible=False
    Btn_Action.Enabled=True
End Sub
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…