iOS Question async methods

Discussion in 'iOS Questions' started by Albi, Mar 30, 2015.

  1. Albi

    Albi Active Member Licensed User

    Hello,

    I just need to try to find a work around for no DoEvents in B4i.
    I want a toastmessage or a label to show briefly, after selecting an option from a message box. At the moment, the code pauses with the WaitFor routine, but the label/message doesn't show. (Though of course it shows when you step thru the code)
    The code I have is

    Code:
    lblWrong.Visible = True
    WaitFor(
    1000)
    lblWrong.Visible = 
    False
    Code:
    Sub WaitFor(Milliseconds As Int)
    Dim s As Long
    s = 
    DateTime.Now
    Do While DateTime.Now < s + Milliseconds
    Loop
    End Sub
    I tried using ToastMessageShow instead of a label, but the same problem occurs.
    I'm sure there's a workaround I just haven't yet thought of...
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    You should never try to block the main thread. It will only cause problems.

    A standard call for ToastMessageShow should work here (after you remove the WaitFor method).
     
  3. Albi

    Albi Active Member Licensed User

    The toast message shows, and then almost straight away the message box appears over it, so I was just trying to get it to pause, but i think moving the location on screen of one or the other would help.
    So I got rid of the waitFor and just used a label instead of a toastmessage, and put the label to the top of the screen.

    Thanks!
     
  4. yonson

    yonson Active Member Licensed User

  5. Albi

    Albi Active Member Licensed User

    thanks, I saw that but wasn't and still am not entirely sure what you did there.
     
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