Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X
Hello
Assuming you have a matrix defined, is it at all possible to use (part of) this matrix to create the choices available in a "Basic combo box"?
More explanation:
I use READEXCEL to read a table from an Excel file, and get a matrix with column headers in the first row, and some other identifier in the first column. Can I put this matrix into a combo box, so that the user can select the relevant row for further calculations?
Regards
Hallvard
I assume that you are talking about Prime, not older real Mathcad, aren't you?
Only way I am aware of to get larger data already present in a basic combo box is to edit the Prime worksheet (which is a zipped collection of xml files).
What you want to do achieve can be done with an Advanced List Box where you can use your Prime matrix as input.
Examples of how to do this were posted here in the forum from time to time.
For example:
Solved: Re: Mathcad prime 10. Advanced Controls. List. Wri... - PTC Community
and as an example of use:
Solved: Re: How to plot Barnsley fern fractal? - PTC Community
Hello @Werner_E
As usual thank you for a quick reply. 😀
Yes, I am talking about Prime, version 11.0.0.0 to be exact.
It was actually quite simple to get one step further based on your simple example. 👍
However, unlike in the screenshot the selection does not appear to influence the return value.
Also the control is "greyed out". My own worksheet also behaves this way.
(Actually tried copying it into a new worksheet, where it is not grayed out, but still the selection doesn't affect the result.)
The (much more) complicated fractal example, however, works just fine! (Usually it is the other way around, simple works, advanced doesn't.)
Have to figure out what the difference is..
Regards
Hallvard
@HP_1364456 wrote:
Hello @Werner_E
As usual thank you for a quick reply. 😀
Yes, I am talking about Prime, version 11.0.0.0 to be exact.
It was actually quite simple to get one step further based on your simple example. 👍
However, unlike in the screenshot the selection does not appear to influence the return value.
Also the control is "greyed out". My own worksheet also behaves this way.
(Actually tried copying it into a new worksheet, where it is not grayed out, but still the selection doesn't affect the result.)
The (much more) complicated fractal example, however, works just fine! (Usually it is the other way around, simple works, advanced doesn't.)Have to figure out what the difference is..
Regards
Hallvard
Hi,
please upload your mcdx file.
He is referring to the sheet i posted here -> Solved: Re: Mathcad prime 10. Advanced Controls. List. Wri... - PTC Community
I just gave it a try - the sheet works as intended in Prime 10 but fails in the way described by @HP_1364456 in Prime 11. At the moment I don't know why (it may be due to a change in the behaviour of ListBox.ResetContent(); ). I'll have a look at it later.
On contrary to what you described the component is NOT greyed out when I open the sheet in Prime 11. Are you sure that you answered the security question when Prime started with "yes" and so allowed scripted components to be active?
Moving the loop which creates the option strings from ListBoxEvent_Exec to ListBoxEvent_Start does the job.
Not sure if this change in behaviour from Prime 10 to Prime 11 should be considered a bug or if there is some reason for the change.
Any ideas?
I guess we ended with more or less the same conclusion, 👌
You using an analytical approach, me using a more brute force technique. 😁
Regards
Hallvard
Hello again @Werner_E and @MartinHanak
I compared the JScript in the simple vs the more complicated (data-vise) example and found that when replacing, function by function from the top, the simple example works as intended once I have modified it as below:
start JScript -------------------
So you found a similar solution than I just did (see my posting a few minutes ago).
Moving the loop from ListBoxEvent_Exec to ListBoxEvent_Start obviously does the job.
As I wrote the original version worked OK in Prime 10 but fails in Prime 11 and I am not sure if this is a desired behaviour to be expected or if its just one more bug???