WaitCursor is not displaying

Hello,

I am using NSBasic 5.2.1.3 and the wait cursor is not displayed whenever the process are not stopped (I understand that is the normal functionality, however it says in the documentation that we can use SetTimeOut function as a workaround to have the wait cursor displayed before the process ends (in this case, I want to display the waitcursor before an ajax call). The thing is that this workaround is not working. Do you know any other way to do this?

My code is the following:

Function ImgFTBtnLunch_onclick()
        If ExistLunch=True Then
                WaitCursor True
                SetTimeout(BuildRequest("L"),0)
        Else
               MsgBox("No existen recetas de comida con los ingredientes seleccionados")
        End If
End Function

'-------------------------------------------------------------------------------------------------------------------------------
' The function that is called is the following

Sub BuildRequest(Timing)
    Dim result
    Dim counter
    Dim counter2
    Dim RecipesMsg
    Dim empty
      empty=True
      'Clears the final message string
      FinalMsg=UserOid & "|"
      'Checks all the product list and store them in the FinalMsg string
      If ScanCode="" Then
          result=$("#LstBoxFilteringProducts").jqxListBox("getCheckedItems")
          result2=$("#LstBoxFilteringNewProd").jqxListBox("getCheckedItems")
          If result.length<>0 Or result2.length<>0  Then
                FinalMsg=FinalMsg & Timing & "|" & CStr(CInt(result.length) + CInt(result2.length)) 
                If result.length<>0 Then
                    For counter=0 To result.length-1
                          FinalMsg=FinalMsg & "|" & result[counter].label
                    Next
                    empty=False
                End If
                If result2.length<>0 Then
                    For counter=0 To result2.length-1
                          FinalMsg=FinalMsg & "|" & result2[counter].label
                    Next
                    empty=False
              End If
          End If
          If (empty=True) Then
                MsgBox "Se debe seleccionar al menos un producto"
                Exit Sub
          End If
      Else
          FinalMsg=FinalMsg & Timing & "|1|" & ScanProductName 
      End If
      'Calls the GetRecipes web service to get the recipe information
      response=WebServiceRequestGet("GetRecipes",FinalMsg)
      If response<>"" Then
        responseString=response
        responseArray=Split(responseString,"|")
        If CInt(responseArray[0])<>0 Then 'Validates if there is any recipe to process
            elementsRecipe=responseArray[0]
            ReDim DishOid(elementsRecipe)
            ReDim ArrayImgDish(elementsRecipe)
            ReDim ArrayNameDish(elementsRecipe)
            counter2=0
            For counter=1 To (elementsRecipe*3) Step 3
                ArrayNameDish[counter2]=responseArray[counter]
                ArrayImgDish[counter2]=responseArray[counter+1]
                DishOid[counter2]=responseArray[counter+2]
                counter2=counter2+1
            Next
        End If
      End If
      If elementsRecipe>0 Then
            RecipeOrigin="FoodTime"
            FrmFiltering=NSB.currentForm
            TimingTitle=""
            Select Case Timing
              Case "B"
                LblRecipeHeader.text="Desayunos"
              Case "L"
                LblRecipeHeader.text="Comidas"
              Case "D"
                LblRecipeHeader.text="Cenas"
              Case "P"
                LblRecipeHeader.text="Postres"
              Case "T"
                LblRecipeHeader.text="Bebidas"
            End Select
            ChangeForm(Recipe)
      Else                 
            MsgBox ("No existen recetas que cubran sus criterios seleccionados")
      End If
      Error=0      
  Catch err
	Error=-1
        MsgBox (err & vbCRLF &  "Routine: BuildRequest")
  End Try  
End Sub

Thanks in Advance,
Adrian

SetTimeout(BuildRequest("L"),0) evaluates BuildRequest("L") and sends the result of that to executed in the future, so the function gets executed immediately.

Try this instead:

SetTimeout("BuildRequest(""L"")",0)

Try substituting 500 or 1000 for the 0 in your code. You need a pause for the wait cursor to start. Your 0 does not actually create a pause.
Helen

Thanks to everyone… you were right. The thing is that the wait cursor is not displayed if there is an ajax call in the same routine.

What I did to solve it, was the following:

  1. Change the onClick code to onTouchEnd event (except for the waitcursor true instruction).
  2. The waitcursor true, I changed on the onTouchStart

And this solved my issue. Thanks to everyone for taking the time to answer.

Best Regards,
Adrian.

can you post your code?

Sorry, I have not entered for a while. The code should go something like this:

Censo is the name of my button but it can be any object:

Function Censo_ontouchstart()
  NSB.WaitCursor(True) 'This will display the wait cursor
End Function

Function Censo_ontouchend()
   [do whatever task you need such an ajax call]
  NSB.WaitCursor(False) 'This will hide the wait cursor
End Function

Important. The ontouchstart and ontouchend events only works directly in the touch screen devices. If you want to test first in your computer replace the ontouchstart event for onmousedown one and ontouchend for onmouseup one.