Is there a way to hide / show interface widgets?

28 views
Skip to first unread message

wade.s...@gmail.com

unread,
Jun 16, 2022, 8:02:05 AM6/16/22
to netlogo-users
I have many sliders and other widgets I need at SETUP time
but then mostly don't need that I'd like to temporarily hide
so the interface is less cluttered.

What's a good way to do this?

I COULD go to LevelSpace,  put all the sliders etc. there,
set everything there and then push the settings to my
running model.

Is there a better way? Like a show/hide switch for widgets?

Wade

James Steiner

unread,
Jun 16, 2022, 8:34:31 AM6/16/22
to wade.s...@gmail.com, netlogo-users
Not as such.

1. You could put all the “setup only” controls on the left, click setup. Then move the view to cover them, exposing the “runtime” controls previously covered on the rightk

2.  Or… a “reset” button could change the world-size to something very small, exposing the setup controls. The “setup” routine sets the world to the correct dimensions, covering the excess controls. 

3.  You could put the setup-only controls in a different model. Pushing the setup button on that model causes that model to write the values to a file , perhaps as a series of NetLogo SET statements. In the main model, setup reads that file, and uses run  command on the contents.

3b. Alternately, GO could do a simple rest to see if the setup file needs to be loaded  (like “if not any turtlrs[ setup] ” )then run it. 

3c. The above could generate a NLS file that is already included in the main model.  But I think then there would be extra steps to make sure the main model reloads the current N-
 NLS. 



—James


--
You received this message because you are subscribed to the Google Groups "netlogo-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to netlogo-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/netlogo-users/a247496d-1107-4924-8786-72f9e06ea13cn%40googlegroups.com.

Paolo Gaudiano

unread,
Jun 16, 2022, 8:38:14 AM6/16/22
to netlogo-users, wade.s...@gmail.com
Not a very elegant solution, but I have worked my way around this by putting the majority of sliders pretty far down (or to the right), so that normally you don’t see them in the window, and then created a label that says “ADVANCED PARAMETERS” with arrows to let users know they can scroll. If you see the screenshot below, notice the label in the bottom left corner (there are many more controls below the two you see here).


Aleria   |  ARC  |  NYU    Forbes   |  TEDx   |  @icopaolo   |  LinkedIn   |    Pronouns:  He/Him/His
--

wade.s...@gmail.com

unread,
Jun 16, 2022, 4:47:02 PM6/16/22
to netlogo-users
OK,  I just wrote what looks like a reasonable and reusable way to move the interface sliders to a separate Heads-up display screen
that you can hide or show.   I implemented this in LevelSpace using the "ls" extension.  It requires two "nlogo" files.  You can
download them both from the Netlogo Modeling Commons if you want to try it out.

I tried to partition the code so it would be easy to add to your own model.   I explain and give examples of the required
levelspace commands so they are easy to mimic and adapt to your own variables and widgets.

The HUD is actually another model called "callable-HUD.nlogo" and has a few sliders you can use to select turtle sizes,
shapes, and numbers and then a button to push to send that info to the main model,  which will update on it's next
GO step.   Well, it should update. It works for me.

Alternatively you can turn on automatic-updates,  and as you move the sliders around in the HUD the changed
values will show up and change the model on it's next GO step.   More fun if you press the GO button and let it
run while you are updating it with the HUD sliders.  It's close to real-time.

The HUD persists variable values over closing and reopening "clear-all" by setting sliders to those values.

They are listed as "Popup HUD - part 1 of 2" and "Popup HUD - part 2 of 2".   If you want to try them out you need to
download them both and put them in the same folder.  They use LevelSpace and won't run over the web.   95% of
the INFO file is in the one you can't even see the CODE or INFO tab for in the Commons.   I'll fix that in the next
version after I get some feedback and you'all help locate the bugs.   :)

Wadecallable-HUD.png
Reply all
Reply to author
Forward
0 new messages