LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Boolean text.Size to text , the boolean text size fixed in my Custom button

Solved!
Go to solution

I edit a custom button , set boolean text size in customized mode, and now it can't adjust width automatically.

I compare it with the original button in labview, the properties size to text are different.

The help document says "You can write this property only for free labels, control labels, and captions."

what I mean  can I set the property in edit mode.

2024-05-07_21h45_36.png

0 Kudos
Message 1 of 19
(467 Views)

MR_SUN_0-1715090062111.png

 

Input more strings in custom control shows only the fixed width content, the original button can adjust width automatic.

 

0 Kudos
Message 2 of 19
(461 Views)

Pictures are useless to debug.

 

Can you attach your control? Is it a control, typedef, or strict typedef? From what palette was the original?

What are you trying to achieve with all this? What "width" are you trying to adjust?

0 Kudos
Message 3 of 19
(429 Views)

@MR_SUN wrote:

I edit a custom button , set boolean text size in customized mode, and now it can't adjust width automatically.

I compare it with the original button in labview, the properties size to text are different.

The help document says "You can write this property only for free labels, control labels, and captions."

what I mean  can I set the property in edit mode.

2024-05-07_21h45_36.png


It is more or less clear how did you get it — just occasionally resized Boolen Text it a little bit. This is enough to lost "default" "Size to Text" property.

 

Screenshot 2024-05-07 18.43.22.png

 

But it is not clear how to revert it back (without recreation control from the scratch), because you can't set this property manually nor programmatically. Also reverting to the original size will not help.Theoretically should be possible to disassemble *.ctl to the separate parts, "tamper" this property and "assemble" it back, but there is no any documentation exists.

0 Kudos
Message 4 of 19
(416 Views)

Try this:

paul_a_cardinale_0-1715102134922.png

0 Kudos
Message 5 of 19
(409 Views)

I have already created a serial of controls and rebuild consume much more time. here is one of them

0 Kudos
Message 6 of 19
(353 Views)

@paul_a_cardinale wrote:

Try this:

paul_a_cardinale_0-1715102134922.png


Unfortunately this will help only partially, because "Size to Text" will remain inactive, in aditional, this will cause overlap with icon if Boolean Text should be not centered absolutely:

Screenshot 2024-05-08 06.08.29.png

0 Kudos
Message 8 of 19
(336 Views)
Solution
Accepted by topic author MR_SUN

Finally got this.

 

Spoiler
TLDR: You can use private property "BasicObjectFlags" to restore original state of the Control.

That was easy and complicated at the same time. Below is a long comment.

Let's say - initially we have two Boolean Buttons, they are "copy-pasted":

image-20240508113905578.png

So far, so good. I will save this VI as "2 Buttons - Original+Copy.vi". As you can see above, for both Buttons we have 'Size for Text' == True, as expected (and they work as expected).Now, I will save this as "2 Buttons - Original+Modified.vi", then navigate to the second Button and customize the Boolean Text - just resize it a little bit using the Control Parts Window (you can use the mouse, it's the same). Now, see the difference:

Modification2.gif

As you can see above, the "Size to Text" Property has gone away (and there's no known way to turn it back).And the major problem is that any attempt to enter text larger than the original will look like this:

Bad.gif

I'll save this VI now in this state.What's the difference between these two controls? To check this, I will open the Heap Peek Window (you have to put "LVdebugKeys=True" key into the LabVIEW.ini file, then restart LabVIEW and open it by hitting Ctrl+Shift+D+H). This is the original Control, note the Flags:

image-20240508115404354.png

and this is modified control:

image-20240508115518573.png

So, the difference between both controls in flags:

 

Original: 0x60966 (0110 0000 1001 0110 0110)

Modified: 0x00966 (0000 0000 1001 0110 0110)

 

So, two bits are lost. One is responsible for "Size for Text", and another one is unknown (may be "Centered"), but this is not very important for the moment — the 'good' value is known as 0x60966. Now, we should revert this back. I will copy the modified VI with two buttons as "2 Buttons - Original+Repair.vi" and open it via the VI Server. The good point is that we can also read the flags which we have seen in the Heap Peek Window with some private Property Nodes ("stolen" from LAVA Forum). I guess you have to enable scripting in the VI Server and put "SuperSecretPrivateSpecialStuff=True" into the LabVIEW.ini. This is what I have (closing opened references and other not-important things are omitted):

image-20240508121046291.png

Now the flags are in our hands, the rest is trivial, because Flags can be written programmatically as well:

image-20240508122630573.png

Now "Size to Text" is restored, and acts as original:

Good.gif

Slightly "rusty nails stuff", use it at your own risk. Obviously, you can easily damage your controls by setting the wrong values.

Experiment in the attachment, downgraded to LV2018.

Message 9 of 19
(304 Views)

@Andrey_Dmitriev wrote:

Finally got this.

 

image-20240508122630573.png


This is very risky.  The bit meanings of Basic Object Flags can, and sometimes do, change between versions of LabVIEW.

For instance, on LV 2021 BOF returns 60000 hex regardless of whether STT is True or False.

0 Kudos
Message 10 of 19
(269 Views)