Reading the amount of states in dynamic panel

Hey, I am currently working with a lot of dynamic panels and wanted to know if there was a way to read the number of states from my panel. I want to have two buttons which click next and previously through the states and to stop accordingly I wanted to know if there was a way to find out the last page. I know there is a function that makes it easier “Wrap from first to last” but I can’t use this in my case.


In the Set Panel State command you can choose Next and Previous at the bottom of the list of states. When you choose that, the checkbox “wrap from first to last” appears which will cause it to wrap in either direction.


Oh - ha!. I just reread your post saying that “wrap from first to last” is not applicable for your situation. The answer is no: there is no way to know the number of states a dynamic panel has.

But since Axure doesn’t allow you to add states to panel on-the-fly using code, you already know how many states a panel has and can identify which state is the first and which is the last.

Let’s say you’re trying to disable “previous” and “next” buttons that navigate through you panel when they don’t apply

OnPanelStateChange (of the panel in question)
  If State of panel (This) equals MyFirstState
    Disable previous button
  Else if
    Enable previous button
  If state of panel (this) equals MyLastState
    Disable next button
  Else if
    Enable next button

OnLoad (of same panel)
  Fire OnPanelStateChange on this