LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

LED Control - Text Question

Hello ppl,

 

I have an LED control over which I have to write a Label which is a longer than the size of the LED. Is there an option that I divide the label name in two lines one below the other.

 

Also, another question - Can I make the background color of the label transparent so that I may have no effect on the color of the the LED control.

 

Thank you and waiting for your fast response.

 

Best Regards

Raunak Gupta

0 Kudos
Message 1 of 5
(3,605 Views)

Ctrl + Enter splits labels in 2 lines.

 

The coloring tool has an option for "Transparent": it's that little "T" in the lower left corner. It's not enabled for every graphical element (e.g. you cannot paint the panel area in trasnparent), but it can be used for label background color.

 

Screenshot 2016-06-09 13.40.19.png



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 5
(3,602 Views)

Dear Roberto,

 

Ctrl + Enter works when we manually enter in UI. But for example I want to read a label from a file and if a label is bigger than the control then how can i divide it into two lines?

 

By the way thanks for the colour question. That worked.

0 Kudos
Message 3 of 5
(3,593 Views)

erraunakgupta ha scritto:

Ctrl + Enter works when we manually enter in UI. But for example I want to read a label from a file and if a label is bigger than the control then how can i divide it into two lines?

 


That's a different matter! In order to get the width of a label you must:

 

  1. Create a metafont with CreateMetafont
  2. Apply the metafont to the control label
  3. Use GetTextDisplaySize to obtain the width of the label and compare it with the control width
  4. If larger that the control, split it embedding a '\n' sequence somewhere in the label (you need to design the algoritm used to locate the place where to split the label)


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 4 of 5
(3,588 Views)

It has occurred to me that step 2 is not needed: look at samples\userint\listdelx CVI example for an example on how to match the metafont with an existing font used in the UI editor when GetTextDisplaySize is used.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 5 of 5
(3,584 Views)