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

Community Tip - You can change your system assigned username to something more personal in your community settings. X

Listbox save state Mathcad Prime 10

kprice
4-Participant

Listbox save state Mathcad Prime 10

Does anyone know how to save the state of a listbox in Prime 10? I know how in v15, but cannot get it to work in Prime. When a worksheet is closed and reopened, the list boxes all reset to the top line, not the choice that was made. I agree a lot of improvements have been made with Prime, but this needs to be addressed. 

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:kprice)

I could track it down to the highlighted  option.

Werner_E_0-1732725588433.png

 

If this option is checked, the listbox reverts to its first entry after reloading the worksheet.

@DJNewman  I guess that this option is not checked in your installation.

 

I we still may consider it a bug because when only the last option is checked (which it is by default, I think), the very same "Advanced Control script" is run on recalculation, but this time the option selected remains intact. So the highlighted option seems to do a bit more. So its either a bug or a defect in the documentation/option text which does not reveal all changes affected by that option.

EDIT: This was wrong!! When the last option is checked a Listbox with a modified script also falls back to option #1 when the sheet is recalculated.

So both options do the same, but the behaviour is different for a Listbox with an unmodified script and also different in different installations of Prime and so far its not clear why.

 

Probably its best to disable this option. After all the rest of the worksheet isn't recalculated on loading and we see a static view of the sheets state when it was saved. So it seems to be consistent if the scripts aren't run as well.
I guess this option is unchecked originally anyway and I seem to have it checked because I didn't know (and still don't) what it actually would be good for 😉

 

View solution in original post

14 REPLIES 14
DJNewman
17-Peridot
(To:kprice)

I can't replicate your problem, and I'm using the default List Box code. I tried on both Mathcad Prime 10.0.0.0 and Mathcad Prime 10.0.1.0 and same thing.

 

I screen-recorded me trying to replicate your issue.


Edit: I can only replicate your issue if you don't save the worksheet before closing it, but...surely you're doing that?

I manage the Creo and PTC Mathcad YouTube channels for PTC, as well as all PTC Mathcad marketing in general.
kprice
4-Participant
(To:DJNewman)

Interesting. No idea why mine is not cooperating. 

kprice
4-Participant
(To:DJNewman)

Try editing the text in the box. For instance, change "One" to "Four" and then see what happens. 

DJNewman
17-Peridot
(To:kprice)

I attached a video of me trying to do as y'all said in Mathcad Prime 10.0.1.0. And it still saves the selection after saving.

 

(You may see in the video a draft of me saying I could get the problem to happen in Mathcad Prime 10.0.0.0, but I'm doubting myself that this actually happened since I can't repeat that after the first time in 10.0.0.0.)

 

If you change anything in a List Box (even just putting in a space) and click Apply, the List Box will revert the selection to the first one in the list. I don't think this is a bug but a feature, because in the scripting environment that pretty much means it's a whole brand new set of code, so it makes sense not to retain whatever was there before. But if you pick a selection after that point, save the worksheet, close, and re-open it, it retains the last selection you made.

I manage the Creo and PTC Mathcad YouTube channels for PTC, as well as all PTC Mathcad marketing in general.
kprice
4-Participant
(To:DJNewman)

I agree that reverting to the first line after a change to the script would not be a bug. And I see in your video that your program is working as should be expected. However, mine does not. And I do have version 10.0.1.0.

DJNewman
17-Peridot
(To:kprice)

Are you able to submit a bug report to PTC Tech Support then? Be sure to give them your worksheet and all.

I manage the Creo and PTC Mathcad YouTube channels for PTC, as well as all PTC Mathcad marketing in general.
Werner_E
25-Diamond I
(To:kprice)

Does it also happen when you use the default Listbox out of the box - the one with options "one" "two" and "three".

Otherwise I only could imagine that you modified the script and have put something like " ListBox.CurSel(0);" in "function ListBoxEvent_Start(".

But if this is the case then the state would also be reset to the top entry when you let the sheet recalculate - does this happen in your sheet?

When you initially add a ListBox the function ListBoxEvent_Start usually is just empty.

kprice
4-Participant
(To:Werner_E)

If I use the default, and do not modify it, then it works as expected. However, if I change any of the text, like change "Two" to "Four", then it no longer works. Same with adding or removing a line. 

 

That was a very good question. 

Werner_E
25-Diamond I
(To:kprice)

Ah,  that's interesting!

 

I can confirm that I experience the very same effect as you. Simply editing the text lets Prime reset the selection to the first entry when the file is loaded.

 

As I guess that this behaviour is not as intended, I would say that you found a bug. Maybe @DJNewman  could confirm.

 

Werner_E
25-Diamond I
(To:kprice)

I could track it down to the highlighted  option.

Werner_E_0-1732725588433.png

 

If this option is checked, the listbox reverts to its first entry after reloading the worksheet.

@DJNewman  I guess that this option is not checked in your installation.

 

I we still may consider it a bug because when only the last option is checked (which it is by default, I think), the very same "Advanced Control script" is run on recalculation, but this time the option selected remains intact. So the highlighted option seems to do a bit more. So its either a bug or a defect in the documentation/option text which does not reveal all changes affected by that option.

EDIT: This was wrong!! When the last option is checked a Listbox with a modified script also falls back to option #1 when the sheet is recalculated.

So both options do the same, but the behaviour is different for a Listbox with an unmodified script and also different in different installations of Prime and so far its not clear why.

 

Probably its best to disable this option. After all the rest of the worksheet isn't recalculated on loading and we see a static view of the sheets state when it was saved. So it seems to be consistent if the scripts aren't run as well.
I guess this option is unchecked originally anyway and I seem to have it checked because I didn't know (and still don't) what it actually would be good for 😉

 

kprice
4-Participant
(To:Werner_E)

I think you are on to something. Both of those buttons are checked on mine. I do find that if I uncheck the highlighted one, then it works as expected, it saves the selections. I have now discovered that I need to uncheck both of those, because if you click the "Calculate" button on the Calculation tab, it resets all the boxes. Not sure how it is working for everyone, but I have to hit this button every time I open a file that has reference file (Include in Prime 10). 

Werner_E
25-Diamond I
(To:kprice)

I can confirm that i experience the same effect. When the last option is set, a listbox which was edited in some way is reset to option #1 when the sheet is recalculated.

It seems that @DJNewman  does not experience the same problem as he has both options set.

Not sure what the difference may be.

Some guesses (just stabbing in the blue) are the original language - mine is German, his probably native US English.

Or maybe the OS? Mine is Win 10.

DJNewman
17-Peridot
(To:Werner_E)

Unfortunately not a good guess, because here are my settings:

 

DJNewman_0-1732726693165.png

 

(They're checked.)

I manage the Creo and PTC Mathcad YouTube channels for PTC, as well as all PTC Mathcad marketing in general.
Werner_E
25-Diamond I
(To:DJNewman)

Too bad!

It seems that the behaviour of my installation is similar to that of the OP but different to yours.

Have no idea why the difference.

 

@kprice 

Which language do you use Prime with. Does it default to US English or is it a different language?

I am using a German Prime 10.0.1.0 but usually use it in English by providing the /culture option.

Have no idea if it may have something to do with the language. I tried it both ways and the effect is the same - the listbox resets to #1 if the highlighted option is set.

 

Announcements

Top Tags