B4J Question Resumable Subs

Discussion in 'B4J Questions' started by Bothwell, Jul 5, 2019.

Similar threads

B4J Tutorial Charts Framework
B4A Library [B4X] B4XPreferencesDialog - Cross platform forms
B4J Code Snippet Tableview header wrap text
B4J Code Snippet Scrollbar Size
B4J Tutorial Msgbox / InputList
  1. Bothwell

    Bothwell Member Licensed User

    I am watching the resumable subs vedio.

    when wait for is introduced (in the vedio) I don't understand why control doesnt go to the button event handler the first time the button is clicked, but continues to execute all lines of code below the wait for.

    I understand that a call to the Wait For keyword causes the sub to be paused and function returns until a certain event has been raised.

    So I don't understand as the click event will still be fired when button was clicked for the first time

    Code:
    ....
       
    Wait For Button_Click
       
    Log("I stole the click event...1")
       
    Log("I stole the click event...2")
       
    Log("I stole the click event...3")  
       
    Log("I stole the click event...4")
       
    Log("I stole the click event...5")
       
    Log("I stole the click event...6")

    End SUb

    Sub Button_Click
        
    Dim duration As Int = 500
        
    Button.SetLayoutAnimated(duration,0, MainForm.RootPane.Height - Button.PrefHeight, Button.PrefWidth, Button.PrefHeight)
       
    End Sub

    those 6 lnes below Wait For are executed when we click the button for the very first time but Button_Click is not called.

    what exaclty is the flow of control ?



    please help me to get my head around this.
     
  2. DonManfred

    DonManfred Expert Licensed User

Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice