04-09-2021 05:05 AM
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.
Solved! Go to Solution.
04-09-2021 05:35 AM
04-09-2021 05:43 AM
Thank you for the answer. So it means it cannot be set because it is none of these?
04-09-2021 06:36 AM
04-09-2021 08:06 AM
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.
04-12-2021 01:23 AM
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:
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.
04-12-2021 02:22 AM
Thanks for the tips, it helped.