How Do I Use ShowPleaseWait

I have this function


Function ShowPleaseWait(title As dynamic, text As dynamic) As Object

    port = CreateObject("roMessagePort")
    dialog = invalid

    if text = ""
        dialog = CreateObject("roOneLineDialog")
    else
        dialog = CreateObject("roMessageDialog")
        dialog.SetText(text)
    endif

    dialog.SetMessagePort(port)
    dialog.SetTitle(title)
    dialog.ShowBusyAnimation()
    dialog.Show()
    return dialog
End Function

However when I call it like so:


                  if index = 6 and over = 1 
                      ShowPleaseWait("","Retrieving Clips")
                      Print "ShowPleaseWait"
                      
                      chooseStreams = 1
                      m.canvas.clearLayer(6) 
                      print "select worked"
                     
                      m.canvas.AllowUpdates(false)
                      m.canvas.SetLayer(5, [            

I never see the ShowPleaseWait screen, even though a print statement placed in the function will actually print, so I know its actually going through the function. Anyone have any idea what I’m doing wrong?

Never mind figured it out. Added


 waitobj = ShowPleaseWait("","Retrieving Clips")

Obvious in hindsight, but now the Showpleasewait screen runs indefinitely. How Does it know when to stop?

waitObj.Close ()

Thanks, that solved my problem.