Binding a pop up button to user defaults

I’m just now finally starting to use binding to user defaults to handle my prefs and while that all looks easy enough for things like check boxes text fields and radio buttons (things with simple values boolean, number or text) Pop up buttons seem a bit trickier.

I haven’t had much luck on finding any documention that specificly covers binding a pop up button to user defaults. Could anybody post a little walk though for that?

I want to bind the the menu items them selves so that the number of menu items and there names and positions in the list get saved in the user defaults along with the currently selected menu item as not only the currently selected menu item but the entire list of menu items can and does get changed by the user while running.

Also this needs to be able to be done with out the popup button being empty on first launch due to no values stored.

This is something I have been handling well enough with glue code but It would lighten up my script considerably if I could cut that whole section out. :slight_smile:

Nope. I’m still stumped here. :frowning:

Okay, how about just binding the currently selected menu item. I seem to be having trouble doing even that.

Wow, nobody knows?

Guess I’ll have to stick with glue code for that.

@ PolarBear
I have the exact same question, where you able to find a solution?

You can save a list to a user default entry. Just save the values in your popup as a list. Then on startup repeat through the list to assign your values to the popup.

For the currently selected item, every time the user changes the selected item in the popup I save this value to the user defaults. Then once the popup is reloaded on launch you set the current menu item to first menu items whose title is “whateverFromTheDefault”.

Dallas