cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

Remember the Last Selection

AjayaMalla
1-Newbie

Remember the Last Selection

Is there a quick and easy script for controls (text box, list box, radio, slider etc) to remember the last selection?

Everytime I open the file, the last selection is lost. I am able to set the required defaults fairly easily but how about the last selection?

Thanks in advance.

5 REPLIES 5

My Mathcad 11.2a remember the slider, the check is default 0, ...

Maybe a version problem

MikeArmstrong
5-Regular Member
(To:AjayaMalla)

Doesn't a "Save As" work?

Mike

Doesn't a "Save As" work?

Only for Web controls. For other controls, no.

RichardJ
19-Tanzanite
(To:AjayaMalla)

There are two approaches:

1) Save the state of the control in the woksheet custom metadata. This method will work in versoins 13, 14 and 15, but not in versions 11 or earlier (I"m not sure about version 12).

2) Save the state of the control in a textbox. This will work in all versions 11 and later, and maybe some earlier versions too.

There are some things to be aware of when using them.

Firstly, in version 11 if the result of calling a function is not displayed, and it's also not assigned to any variable, Mathcad does not calculate it. That means that if you use method 2 and put the SaveData function in a collapsed area it will not work. In version 12 and later they removed this optimization, and therefore it will work.

For the second method, if the Listbox is off screen at start-up and there is a calculation using the output from the Listbox in a collapsed area then mathcad appears to generate a new (blank) mathcad process on the windows taskbar. This problem applies only to version 12

Saving the state in the custom metadata causes another mathcad.exe process to be started. There is at least one report that in version 14 Enterprise Edition (this does not apply to the Single User Edition) this new mathcad.exe process requires an additional license, so you get a popup error every time you run the program. I don't know if this has been fixed for later service releases of version 14, but it does not occur in version 15.

Saving the state of the control in the custom metadata will not work if the control is in a referenced worksheet (because it can't see the metadata). Method 2 will work if the control, and SaveData function, are in a referenced worksheet.

Method 1 is much slower (about 6 times slower!) than method 2. This doesn't matter much if you have only one control, but it can make a big difference if you have a large number of them.

RichardJ
19-Tanzanite
(To:RichardJ)

This question comes up so often I decided to post the answer in a place I can easily find next time:

http://communities.ptc.com/docs/DOC-1379

In future I will post only a link to the answer. This also has the advantage that if I update the worksheets I only have to do it in one place. I already updated one of the sheets in fact, so if you want the latest version get it from the link above, not this thread.

Top Tags