Skip to main content
1-Visitor
July 4, 2011
Solved

Text box VB Script display

  • July 4, 2011
  • 3 replies
  • 19390 views

I wrote a VB script for a text box to highlight condition based on the input variable. However, when I print the mathcad file is doesn't display the color of the textbox. Is there a setting that I'm missing that is causing it to print incorrectly?

Attached a sample mathcad file that contains the script. I apologize in advance if this is a repost.

Any help is greatly appreciated, Thanks.

Best answer by RichardJ
Is there a way to make the scripted label have a pre-defined width? E.g the width of the page.

Yes, although it's something of a pain to size the label, because you can't just drag it to the correct size.

In the script add a line

TextLabel.Caption="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

After the "End If". Make the text string long enough that the label is the size you want. Exit the script, select it, hit F9 to make sure it updates to the desired size. Now in the script remove that line, and set TextLabel.AutoSize = 0. It will now stay at that size. You may also want to add the line

TextLabel.TextAlign = 2

in the top section, which will center the text.

3 replies

24-Ruby III
July 5, 2011

Hello!

Which version of Mathcad you use?

This version suits you (in PDF)?:

PDF_output.jpg

1-Visitor
July 5, 2011

Please see attached. I have used a scripted Label component, which seems to work.

I have no idea why textboxes do not display when printing.

Mike

19-Tanzanite
July 5, 2011

I have no idea why textboxes do not display when printing.

It looks like a bug to me.

1-Visitor
July 5, 2011

When using the label scripted component the following command seems to be the line which makes the background visible when printing.

TextLabel.Caption = Inputs(3).Value

Textboxes do not support this function though.

Mike

15-Moonstone
July 24, 2011

I downloaded the "Extra Components.mcd" to start the learning process on using VB. There two programs that caught my attention to help writing the reports. The first was eqnum which provided a method to count figures. The second was VarValue which set text. I would like to combine the two program so I can set the text in eqnum. I have tried several but got errors each time. I have attached a file with the two programs.

Thanks in advance for the support.

David Tg

19-Tanzanite
July 24, 2011

It's not clear to me what you want when you say "combine them". Do you mean you want to able to set the text style in the caption?

15-Moonstone
July 24, 2011

I am able to add text to the caption. Running the VB results are:

Figure (1) This is the caption

Unfortunately, I would like the output to be in Times New Roman, 12 pt. It seems the second program is able to set the font. That is what I would like to combine from the second file.

Thanks,

David Tg