How to add a menu port to a subnetwork

john's Avatar

john

24 Jun, 2024 12:46 AM

People occasionally ask how I make the menus in the subnetworks I publish in my library. This is not well-documented, so I thought I'd explain it again in a separate post that might be easier to find...

To make a subnetwork with a menu port:

  • Create a subnetwork and publish a string node (even if you want to use it to make numbers).
  • Then go back up, select your subnetwork, and open the Metadata dialog.
  • Select the string port from the list on the left
  • Change Widget (on the right) from String to Menu
  • At the bottom right of the dialog, press the plus button to add your first menu option
  • For each option, supply a Key and a Label. The Key will be the value received through that port; the Label will be the description text that appears in the menu
  • You can use the other buttons to delete or reorder menu items; click on an existing menu item to edit it.
  • Click OK to close the dialog. Your menu is now ready to use. It will be empty until you set it to an option the first time.

Inside your subnetwork you can then turn that string into a number if you want (or not). I usually define keys of 0, 1, 2... and then feed it directly into a switch node.

It's pretty nice. All that power hidden away in the Metadata dialog. And even though the port now functions as a user-friendly menu, you can still feed it key values directly from another node. My image node has seven levels of quality, but you can also just feed it the number of kilo-pixels directly from another node.

Notice that when you publish a string you have a number of other widget options:

  • Data - used for the Freehand node; don't see how we can use this more generally
  • File - provides a button with a 3 dots icon that summons a file dialog; from this you can derive a file path
  • Font - lets you select a system font
  • Image - like File except that it restricts your choices to PNGs, JPEGs, GIFs, etc.
  • Menu - described above
  • String - a normal string field
  • Text - seems to work just like string; I don't know if there's any difference

Note: to add a checkbox just publish a boolean node.

  1. 1 Posted by florisdejonge on 23 Nov, 2025 09:18 AM

    florisdejonge's Avatar

    Hi John,
    Thanks for providing the documentation. I've been returning to this every once in a while. Just wondering: is it possible to change the order of the ports of a subnetwork? When I group a set of nodes into a subnetworks, it shuffles them a bit, favoring the geometry it seems. When I make a subnetwork first, and then add ports it does so in that order. But sometimes I change the ports or add some and for usability I'd like to change the order. Do you know how?

    Floris

  2. Support Staff 2 Posted by john on 23 Nov, 2025 12:29 PM

    john's Avatar

    Floris,

    I frequently change the order of the ports in my subnetworks as I'm developing them, but it's a bit of pain.

    The only way I know of is to unpublish all the ports and then republish them in the order you want. When doing this you may also have to reenter the range for each port (Value or List) and the min/max values if any. This is especially painful if one of the ports is a menu; unpublishing and then republishing a menu port forces you to redefine the entire menu.

    The menu widget has arrow buttons that allow you to reorder menu items. Sadly, the port widget has no such feature.

  3. 3 Posted by florisdejonge on 24 Nov, 2025 03:36 PM

    florisdejonge's Avatar

    Thanks for the reply John. I was afraid this would be the answer unfortunately. I'll just keep doing the work of deleting and republishing.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

26 Nov, 2025 06:16 AM
24 Nov, 2025 03:36 PM
16 Nov, 2025 11:08 PM
25 Oct, 2025 02:52 AM
26 Sep, 2025 10:03 PM

 

19 Sep, 2025 03:34 PM
09 Sep, 2025 08:12 AM
09 Sep, 2025 12:45 AM
07 Sep, 2025 04:13 AM
03 Sep, 2025 04:20 AM
29 Aug, 2025 10:31 AM