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

Area collapse/Expand in Mathcad15

vmurugan
1-Newbie

Area collapse/Expand in Mathcad15

Hi,

I need to expand or collapse an area in Mathcad 15 using excel vba.. Is it possible.. Need help.?

11 REPLIES 11

Sorry, that is not possible.

Richard, is it possible using scripted components within Mathcad?  For example, can you get a region to expand/collapse based on the value of a variable?

Theoretically possible, but would need a good programmer to implement it.

File attached as 2 examples of modifying the XML code behind Mathcad to achieve different tasks.

a combination of these effects could create a scripted component that would open/close (disable?) an area.

the problem then is to trigger the event - an input to the component should work, but will need a functional component to test.

if an area is given a tag in the properties menu then the str2Val function approach can find it,

within the area is a section

area is-collapsed=      either    "true"  or    "false".

another section is disable-calc , again   either    "true"  or    "false".

this does appear to disable a command within the area.

the last part will be to re-write this XML code in the running file & trigger a re-calculate (if necessary).

regards

Andy

While, in theory it seems possible, the API does not allow access to all of the XML code so directly it doesn't help.

there may be other ways to access the XML but will be increasingly difficult.

Theoretically possible, but would need a good programmer to implement it.

Sorry, but theoretically not possible. The API allows access to the XML of a math region, but that is all. An area is not a math region, so you can't do anything with it via the API. If the Mathcad file is not open it would be possible to modify the XML of the file itself so that next time it was opened the area was either open or closed (assuming it's not locked of course), but that's all.

Hi

Thanks for the reply.

But I have completed the task by using some simple excel vba functions.

Regards,

Vino

Really? How? Via the API or by directly manipulating the XML in the Mathcad file? I know how to do it by manipulating the Mathcad file, but I see no way to do it via the API.

So share your solution with the community.

Hi,

It is not possible through direct Mathcad commands but still it possible through system screen setting commands.

MC.ActiveWindow.ScrollTo 0, rk.Y                  ''Fix Tag Name to the area which needs to be collapsed/expanded and scroll down to the location of the area by tag name.

AppActivate MC, False                                  ''Enable/Activate Mathcad screen

MC.Left = 0                                                                                          ''Set Mathcad Screen to Left Corner to the display screen.

MC.Top = 0                                                                                          ''Set Mathcad Screen to Top Corner to the display screen.

mouse_event MOUSEEVENTF_LEFTDOWN, 0&, 0&, 0&, 0&                  ''Double click command

mouse_event MOUSEEVENTF_leftUP, 0&, 0&, 0&, 0&

mouse_event MOUSEEVENTF_LEFTDOWN, 0&, 0&, 0&, 0&

mouse_event MOUSEEVENTF_leftUP, 0&, 0&, 0&, 0&

This really works.

Have fun.

Regards,

Vinoth        

Hi all,

Did anyone tried this.?

Any comments?

Regards,

Vino 

I have personally never had a reason to want to do this.

Can you please explain to me in Detail, how you inserted the Excel VBA script?

Thanks,

René

Announcements
Check out the latest
Mathcad Tip
"PTC Mathcad 15 / Prime 1-6 Update."