Do SQL commands interrupt the message path?

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
JustinW42
Posts: 52
Joined: Sun Nov 30, 2014 7:22 am
Location: Upland, CA
Contact:

Do SQL commands interrupt the message path?

Post by JustinW42 » Mon Mar 09, 2015 9:44 am

I am trying to place a "rotating" image overlay group that appears any time my app is busy handling data in the background... I use the following code to update the image in the group:

Code: Select all

on RotateSpinner
   
   if gKeepRotating is 1 then
      
      put the angle of image "imgSpinner" of grp "grpSpinner" of this card into tAngle
      
      put tAngle - 45 into tAngle
      
      if tAngle < 0 then
         put 315 into tAngle
      end if
      
      put the name of this card && tAngle
      
      set the angle of image "imgSpinner" of grp "grpSpinner" of this card to tAngle
      
      --send "RotateSpinner" to me in .1 second
      send "RotateSpinner" to me in .1 second
      
   end if
   
end RotateSpinner
I have a StartSpinner and EndSpinner handler which takes care of the variable to ensure the routine continues running...... It also makes the group visible / invisible depending on whether or not it is in use. When I force the routine to execute (using the Message interface) the image rotates beautifully.... However, when I enable the rotation through code (just before a number of SQL subroutine calls), the spinner group shows up, rotates 45 degrees exactly one time, then simply stops..... When the code moves the user to a new card, the group remains visible even though I disabled the visibility of the group in the EndSpinner handler.......

Any ideas? I am thinking the "Send XXX to me in XXX seconds" is being blocked once I begin executing the various SQL subroutines..... So what is the proper way to approach a situation like this? I want the spinner to be updating while the app is busy, but if the animation is blocked it doesn't do me any good. haha As always, any tips are appreciated!
-------------------------------------------------------------------------------------------------------------
Some things I do: http://www.katanadtg.com --- http://www.dtgprintsolutions.com

JustinW42
Posts: 52
Joined: Sun Nov 30, 2014 7:22 am
Location: Upland, CA
Contact:

Re: Do SQL commands interrupt the message path?

Post by JustinW42 » Mon Mar 09, 2015 9:47 am

Since I am quite sure someone is going to bring this up, here are my Start and End handlers for the spinner code....

Code: Select all

on StartSpinner
   put 1 into gKeepRotating
   set the visible of grp "grpSpinner" of this card to true
   RotateSpinner
end StartSpinner

on EndSpinner
   put 0 into gKeepRotating
   put the name of this card && "HIDDEN"
   set the visible of grp "grpSpinner" of this card to true
end EndSpinner
-------------------------------------------------------------------------------------------------------------
Some things I do: http://www.katanadtg.com --- http://www.dtgprintsolutions.com

JustinW42
Posts: 52
Joined: Sun Nov 30, 2014 7:22 am
Location: Upland, CA
Contact:

Re: Do SQL commands interrupt the message path?

Post by JustinW42 » Mon Mar 09, 2015 9:48 am

I added the "of this card" code to see if I could figure out why the group wasn't "hiding" itself on all the subsequent cards (I used the Add Group tool in Livecode to add the spinner group to a number of different cards on the stack).
-------------------------------------------------------------------------------------------------------------
Some things I do: http://www.katanadtg.com --- http://www.dtgprintsolutions.com

JustinW42
Posts: 52
Joined: Sun Nov 30, 2014 7:22 am
Location: Upland, CA
Contact:

Re: Do SQL commands interrupt the message path?

Post by JustinW42 » Mon Mar 09, 2015 10:02 am

Ok I will admit I'm a dummy - I was setting the visible of the group to TRUE in the EndSpinner routine.... That is resolved and the group now hides properly (which is reflected on all subsequent cards which contain the same group).

The animation still doesn't run when I actually use it during a "thinking" process (when the app is doing stuff in the background like downloading SQL, etc) - I put the following code into a button and the animation looks great for 10 seconds before properly hiding itself, so I know the animation code is solid at a fundamental level - however, this doesn't seem to work the same way when I am doing other things in the app.

Code: Select all

on mouseUp
   
   StartSpinner
   
   wait 10 seconds with messages
   
   EndSpinner
   
end mouseUp
-------------------------------------------------------------------------------------------------------------
Some things I do: http://www.katanadtg.com --- http://www.dtgprintsolutions.com

JustinW42
Posts: 52
Joined: Sun Nov 30, 2014 7:22 am
Location: Upland, CA
Contact:

Re: Do SQL commands interrupt the message path?

Post by JustinW42 » Thu Mar 12, 2015 10:12 am

NOTE: For iOS devices I found out about the iphoneActivityIndicatorStart function and I implemented it into my app, since this particular project is not going to be used on desktop anyways.... However, I am unhappy with how small and almost invisible the spinner is on most of my cards, so I am still looking to make my proprietary handler work....... Any ideas why the RotateSpinner command is not being called repeatedly (as it is supposed to) while my app is busy doing its required "thinking" and SQL downloading??
-------------------------------------------------------------------------------------------------------------
Some things I do: http://www.katanadtg.com --- http://www.dtgprintsolutions.com

Post Reply

Return to “Talking LiveCode”