Use variable to show widget

advanced-prototyping

#1

I’d like to show items based on the page the user did visit before. So I put the page name in a global variable on leave and want to show the widget with the name on the next page.
Example: Page is “red_bag”, widget on following page is named “red_bag”. My idea is set the visibility of the widget with the same name as the value stored in the global to true. But I see no possibility to add a formula for the show action for simple widgets.
Do I have to use a Dynamic Panel? If so, why? This seems too complicated for me…

Thanks for pointing me in the right direction!


#2

You can show/hide any widgets, not only dynamic panels


#3

What I want to do is showing it via scripting, without having to select each widget in the pane. Instead I want do achieve something like that (in pseudo-code):
global myWidget
on pageLoaded
show myWidget
end
In the global myWidget I store e.g. “red_bag” and also “blue_bag” etc.
Then, when this page is loaded, the widget “red_bag” is shown when this is the value of the variable. And “red_bag” if this is the value. And “green_shoes” if this is the value… etc.
This is super easy to do in proper programming but I can’t understand how I do it in Axure.
Thanks for helping me with this!


#4

In Axure 9 (not sure, if tis possible in 8), you can group these widget and than only say, show the group.


#5

Sorry, but it is not possible. I want do do it via a variable. And the editor does not let me enter a value for this, all I can access is the popup where I can select each widget manually. And I want to do it just once in an interaction tied to the page, not to a widget.


#6

What about adding a dynamic panel (lets called it “DP1”) to a page and each state is the name “red_bag”, “blue_bag” etc, and those states contain their related content. Add a page load interaction on the page with a “set panel state” action, select DP1, state = value, then set the value to be your Global Var (you’ll need to use the function builder/edit value dialog to do this).

so if user looks at red_bag, and leaves - “red_bag” gets saved to your GV, then on this other page, the red_bag state is set showing whatever content you want to show. Make sure the possible GV values you save are named exactly the same as the states, including upper/lower case.

Make sense? Shout if you need help.


#7

@ GraemeDearie Thanks for your reply! Yes, this is what I ended up doing, so I can confirm your solution it is working :slight_smile:
But I thought maybe there is a more elegant way of doing this …

And, it would help me a lot if I could understand why I can’t set a value for some widgets, but I can set a value for states for dynamic panels. It is also unclear to me why I can’t hide the instance of a master on a page but I can hide it if it is in a DP. Is there a system behind it? Is it explained somewhere? (I did look for it thoroughly, I think, but to no avail.)
Thanks for helping me with this!