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

Automatically changing color and text depending on a condition, an aesthetical question

ClaudioPedrazzi
11-Garnet

Automatically changing color and text depending on a condition, an aesthetical question

Dear all,

I got from some old, long forgotten   training course the following (here very simplified) example of a scripted automated change of colour and text depending on a Boolean condition.

This is to me pretty useful, for example when there are many requirements that I have to prove all satisfied for example for a structural verification.

The only "problem" in this implementation is that the condition appears under the "traffic light" red / green message.

Unbenannt.JPG

This is because the Arguments have to be under the box.  I would definitely prefer having the coloured text message either on the right of the condition, or under it. Because it is a logical consequence of the condition, so the reading should go from left to right and downwards.

Of course I could define a dummy variable containing the condition and then use this one as dummy argument, and then "hide the arguments". This is a little error-prone when ones makes many cut-and-pastes.

This is admittedly a low priority aesthetical question...

But maybe ...

Anyway, thanks for any idea and best regards

Claudio

1 ACCEPTED SOLUTION

Accepted Solutions

How about hiding the arguments of the text fields and either writing the conditions twice or assign it a variable?

View solution in original post

11 REPLIES 11

How about hiding the arguments of the text fields and either writing the conditions twice or assign it a variable?

-MFra-
21-Topaz II
(To:Werner_E)

Hi Werner,

It does not work for me, why?

caselle a colori.jpg

Werner_E
24-Ruby V
(To:-MFra-)

You mean you get this error after opening Claudios and/or my file?

You should be asked if you want to disable scripts when you open those files and you have to click "No" for the components to work.

The error message you show indicates an error in the script of the component but I guess you have not changed anything - right?

Are you able to create scripted components yourself from scratch? (menu -> Insert -> Control -> Textbox)

Do scripted components work otherwise in other sheets in your configuration?

If "no" then you may consider registering those mcm files. As far as I remebmer there is a program with the name mcmreg.exe you have to call run as admin). Guess you can find references here in the forum when you search for,

Here are some findings:

Re: Problem with creating list box or other controls

Re: Trying to insert radio button

Re: Scriptable objects will not work MathCAD 15

Re: Drop-Down Boxes Not Working?

-MFra-
21-Topaz II
(To:Werner_E)

I'm sorry, all happens opening your file..

Werner_E
24-Ruby V
(To:-MFra-)

OK, but does it happen with this one file alone or with every file containing scripted controls?

Have you tried the file below?

Have scripted controls ever worked for you in your current configuration?

Have you tried mcmreg as suggested above?

-MFra-
21-Topaz II
(To:Werner_E)

It happens opening  your attached file. It is since last year, when I worked with radio buttons, that I don't create "script files"  for control tools. Now I don't remember if at that time I used M14 or M15. Now I've no time to test mcmreg. TestListBox is OK!

Werner_E
24-Ruby V
(To:-MFra-)

> TestListBox is OK!

Thats really strange as there is nothing in the first file which is not present in TestListBoxes.

Werner_E
24-Ruby V
(To:-MFra-)

How about the attached file?

Do you experience the same problem with it?

I use pictures for this. And the if operator. Without scripts!

Thanks to Werner and Valery for the answers!

I will go with Werner's method, that is actually what I also was thinking... somehow I do not like to duplicate expressions ...they have the bad habit not to change both when you change one of them .  (I used to be a FORTRAN programmer, a lot of time ago... some habits are deeply rooted...).

The variable assignment followed by hiding the arguments seems, for my needs, the best solution.

The idea of Valery is genial, I would have never thought of it! But it is less flexible (changing the text for example) and it still has the same problem that the condition appears under the image (my original question).  And it would force me to "distribute" the picture files too, if I want to let someone else use my Mathcad-Worksheet.  On the other side, it does not need scripting, that is a bonus. Someone could appreciate that.

I have implemented it too in the attached file (and of course one needs also the two jpegs).

Again thank you everybody

Regards

Claudio

My method does not scripts and I use it in Mathcad Server!

Top Tags