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

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

Using list control to control reference

CarlDreher
1-Visitor

Using list control to control reference

I have many long, configuration files. They are called by a single reference from the main program. To change from one file to another, I have to click on the reference, select Properties, and then browse to the config file. I want to use a List control so the user can simply select the desired file. I haven't found a a way of controlling or selecting a reference in a script control. Anyone know how to do this? I checked the past discussions here and someone asked this in 2003 and didn't receive an answer.

9 REPLIES 9
RichardJ
19-Tanzanite
(To:CarlDreher)

Sorry, but there is no easy way to programmatically change a referenced worksheet. The only possibility would be a scripted component that changes the XML of the region. That would be a lot of work to write, and even then I think the new worksheet will not be loaded automatically. You would need to select the region and hit Ctrl F9 to get it to load (I am not 100% certain of that, but I think that will be the case).

>I have many long, configuration files.

They are called by a single reference from the main program.<

______________________________

The gigantic "Create Amazing Images" is all globally define.

No reason it should not work for other types of projects.

jmG

What in the world are you talking about? "Create Amazing Images" is...?

mzeftel
12-Amethyst
(To:CarlDreher)

Creating Amazing Images with Mathcad 14 is a E-book by Byrge Birkeland. I posted in the Mathcad Community at

http://communities.ptc.com/community/mathcad/mathcad_usage/blog/2010/05/27/creating-amazing-images-with-mathcad-14

I don't see how it will help with your issue, but it's a great example of what you can do with Mathcad 2D and 3D plots.

Mona

>I don't see how it will help with your issue, but it's a great example of what you can do with Mathcad 2D and 3D plots.< [Mona]

_________________________

What you see mostly is 2D, 3D but those things come from multiple creations, just as a particular result but it applies to any other kind of project. That was my original point in the suggestion. [jmG]

So, you have a file MainProg.mcd and other named config01.mcd, config02.mcd, etc.

Try this: inside MainProg.mcd insert a reference to MainProgConfig.mcd and a List control that

1. Delete MainProgConfig.mcd if it exists (there are somewhere a nice discussion about implementing the funcion FileExists in mathcad)

2. Copy the selected configuration file as MainProgConfig.mcd (remember that in old DOS copy have the option to change the final name)

Those tasks must to be done with a vbscript conde inside the list control.

Probably you must to use Ctrl F9. Also can check what happen trying to preserve the state of the control, etc.

Regards. Alvaro.

>there are somewhere a nice discussion about implementing the funcion FileExists in Mathcad<

_____________________That one ?

MCADfile_1.gif

Cheers Alvaro, you are back !

Yes, Jean, precisely this nice function, post is http://communities.ptc.com/message/131204#131204

And thanks, I assume that I'm back, so, thanks for your welcome.

Regards. Alvaro.

AlvaroDíaz wrote:

So, you have a file MainProg.mcd and other named config01.mcd, config02.mcd, etc.

Try this: inside MainProg.mcd insert a reference to MainProgConfig.mcd and a List control that

1. Delete MainProgConfig.mcd if it exists (there are somewhere a nice discussion about implementing the funcion FileExists in mathcad)

2. Copy the selected configuration file as MainProgConfig.mcd (remember that in old DOS copy have the option to change the final name)

Those tasks must to be done with a vbscript conde inside the list control.

Probably you must to use Ctrl F9. Also can check what happen trying to preserve the state of the control, etc.

Regards. Alvaro.

Actually this sounds not too hard, The key is probably a need to for a worksheet recalculate of the selected file.

It would be a kludge of the Table of Contents component (which creates its own list) and the file directory components.

I've attached my "template" which has the components in it (and other stuff collated from other collaborators!)

Philip

Announcements

Top Tags