Page 1 of 1

MsgBox being a bit odd . . .

Posted: Thu Aug 04, 2022 2:43 pm
by richmond62
SShot 2022-08-04 at 16.32.54.png
-
Has this script in the button:

Code: Select all

on mouseUp
   put 1 into QS1
   repeat until QS1 > 9
      put 1 into QS2
      repeat until QS2 > 9
         put QS1 & "," & QS2 into fld "ff"
         put QS1 & "," & QS2
         wait 15 ticks
         add 1 to QS2
      end repeat
      add 1 to QS1
   end repeat
end mouseUp
Which is extremely pedestrian, and should deliver QS1 "," QS3 in the messageBox simultaneously to delivering
it into the field, but that does NOT happen: the messageBox stays empty until both the repeat cycles have finished,
then all the numbers cycle in the messageBox extremely quickly . . .

AND that is only visible IF the user opens the messageBox before hitting the button: otherwise the messageBox
appear at the end of the whole process with 9,9.

MacOS 13 public beta 2
LiveCode 9.6.3, 9.6.8, 10 DP 4

It works PERFECTLY (as expected) in LiveCode 8.2.0 DP2

Re: MsgBox being a bit odd . . .

Posted: Thu Aug 04, 2022 2:44 pm
by richmond62
This is a real pain in the bum for checking any sort of loop.

Re: MsgBox being a bit odd . . .

Posted: Thu Aug 04, 2022 4:16 pm
by bobcole
Try adding "with messages" to the wait command:

Code: Select all

wait 15 ticks with messages
That works for me.
Bob

LiveCode 1.0.0-dp-3
MacBook Pro (M1 Arm)
macOS 12.5 (Monterey)

Re: MsgBox being a bit odd . . .

Posted: Thu Aug 04, 2022 5:04 pm
by richmond62
That works for me.
It probably does, but that should not be necessary.

(A nice glass of whisky works for me, but it is not necessary.) 8)

Re: MsgBox being a bit odd . . .

Posted: Thu Aug 04, 2022 5:30 pm
by jacque
Loops do not yield to the engine unless you tell them to, so redraws don't happen without specific instructions. If it were otherwise, repeat loops would be even slower than they are now.

Re: MsgBox being a bit odd . . .

Posted: Thu Aug 04, 2022 5:41 pm
by richmond62
I wonder why everything behaves 'as it should' in LC 8.2.0 DP 2, and not in LC 9.6.3 and upwards?

Oh, and before you ask: LC 8.2.0 DP2 runs without a hitch on MacOS 13 public beta 2.

Re: MsgBox being a bit odd . . .

Posted: Thu Aug 04, 2022 5:42 pm
by stam
Yes I think even

Code: Select all

Wait 0 with messages
works, and for the reason Jacque says… the “with messages” bit gives the engine a look-in to update the interface etc. essential if you want to be able to cancel a long loop using a button etc.

Re: MsgBox being a bit odd . . .

Posted: Thu Aug 04, 2022 5:44 pm
by stam
richmond62 wrote:
Thu Aug 04, 2022 5:41 pm
I wonder why everything behaves 'as it should' in LC 8.2.0 DP 2, and not in LC 9.6.3 and upwards?
Just guessing but it’s probably due to a effort to optimise loop performance.