LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Set BoolText.Size To Text? throws an error

Solved!
Go to solution

I am trying to set "BoolText.Size To Text?" property of an OK Button but it generates an error. When I try to run it an error message appears saying "VI Server property is read-only." See attached screenshot and the VI itself. Does anyone have any idea why this happens and how to set the property? Thank you.

Download All
0 Kudos
Message 1 of 7
(1,852 Views)
Solution
Accepted by topic author Messier31

From the help file: You can write this property only for free labels, control labels, and captions.

 

Ben64

Message 2 of 7
(1,815 Views)

Thank you for the answer. So it means it cannot be set because it is none of these?

0 Kudos
Message 3 of 7
(1,803 Views)

What are you really trying to achieve? I am guessing that you want to resize the control depending on the text on it? Or what other reason could there be to resize the text in the control?

Certified LabVIEW Architect
0 Kudos
Message 4 of 7
(1,778 Views)

Yes, exactly. I want to resize the button to fit to the text on it. I also might want to avoid the automatic resizing when the text changes but it's not the case now.

0 Kudos
Message 5 of 7
(1,765 Views)

LabVIEW automatically enlarges the button if the text will not fit. What you could do is to have too small buttons for any text that you will have on the button, then run your code that sets the boolean text. 

 

Another option is to keep your default button size but use labVIEW's autosize to enlarge the button. Set the ButtonSize to 1;1 and write the text to resize the button. A drawback is that the position of the button will creep upwards and to the left (looks like a bug, why would it creep upwards if the button is not even resized in that direction?). So just read and set the position when the autosizing is done:

thols_0-1618208263316.png

You could also use Get Text Rect.vi to get the size of the text and set the button size from that. If you do this, make sure to inactivate the autosizing by right-clicking on the button and select "Release Text", or set the property "Lock Boolean Text in Center" to false first.

Certified LabVIEW Architect
Message 6 of 7
(1,681 Views)

Thanks for the tips, it helped.

0 Kudos
Message 7 of 7
(1,674 Views)