Storing and retrieving control settings from/to a panel via a Structure
I want to store the settings in a panel to recall if the panel is closed and reopened. The panel attaches to a graph window. I have settled on using a Structure. I had hoped to store the entire structure into a defined UserData string for the graph window. If I understand correctly, I will have to step through each component in the structure, convert it to a string, and append the string into a keyword-value pair list. I have to invert the process to recover the values.
Does anyone have suggestions on an approach that is less tedious, inflexible, and error prone?
As a follow up comment, I am basically seeking the equivalent to StructPut/Get with /S to encode/decode an entire structure into/out of a string. In the meantime, perhaps this is a feature request to have flags StructPut/S/A and StructGet/S/A, whereby /A means to encode/decode the entire structure into/out of a string.
I am not interested in Load/SavePackagePreferences because I want to store the panel settings to the graph window.
Finally, it would also be great if implemented to have the StructGet/Put operations with /A to encode/decode character and string variables too, not just numbers.
This is IP 9 BTW.
It's frustrating not to be able to do what you describe. I assume that the goal is to to have panel information associated with an arbitrary number of graph windows, without saving any package clutter elsewhere.
I think that if you redefine the control structure to use char arrays instead of strings your approach will work. That's how strings are stored in package preference files.
perhaps something like this
January 23, 2026 at 01:16 am - Permalink
note that when the help says
"The structure fields to be exported must contain only numeric data in either integer, floating point, or double precision format"
that includes char members, which are 1 byte integers.
January 23, 2026 at 01:24 am - Permalink