Wow! - What the heck is going on here?


#1

Take a look at this simple prototype made with a button and two labels:

What happens to FinalMessage when you press the button?

  • Well it says “Success!” of course - just like you would expect.

Now let’s add a simple Wait() statement:

What happens to FinalMessage when you press the button?

  • NOTHING

That makes no sense.
Anyone know what is going on?

WhyWait.rp (46.9 KB)


#2

Well… OK… I seem to have the answer, and it has somewhat surprised me.
Different paths on Case statements are executed SIMULTANEOUSLY.

Mind… Blown…

Here’s a modified version:

As you can see if you execute this, both conditional paths run in parallel.
I’m used to every event being fired asynchronously - but conditional paths executing simultaneously is new to me. In all the time I’ve used Axure, I never knew that.

This explains pretty much every bug I have ever had.

WhyWait2.rp (46.6 KB)


#3

Hi!

(I didn’t notice your reply above. Skip to workaround below)

The Wait command only makes things in the first condition wait. E.g., the second Set Text command will wait to execute. However, the Wait in the first condition does not make the second condition wait: it is evaluated right away. (The same thing would happen in Javascript, etc.)

You can verify this (but not fix it) by changing the condition in Case 2 to:

IF (value) 1 equals (value) 1

…which will execute no matter what. You’ll see that the second widget gets the “Success” message immediately.

Not the answer you are looking for, I’m sure! If you describe what you are hoping to achieve, I’m sure there’s a workaround.

[Edit]

Actually, here’s a workaround. You can call a “function” to test for the result after the wait, and the put the second condition in the function. The reason function is in quotes is that Axure doesn’t really have functions, but you can simulate one by creating a widget (I use a hotspot) that handles the Moved event, and move that hotspot by 0,0 when you want to “call the function” example:

  On Click or Tap (of button)
    Set Text on label 1 to "A"
    Wait 1000
    Set Text on label1 to "B"
    Move hotspot "test label1" by 0,0

  On Moved (of hotspot "test label1")
    If text on label1 equals B
      Set text on label2 to Success!

You can make as many of these hotspots as you want, so you can test for multiple different things. Or you can of course put multiple conditions in a single hotspot.


#4

Axure experts: Are there any other commands other than Wait() that can cause this to happen?