LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Blinking covers caption

Highlighted

Hi,

 

I dont like the fact that the contents of string controls can not be centered vertically so wrote a small routine which displays text in the caption and centers the caption both horizontally and vertically to the control it belongs to. 

 

Its kind of a bitter surprise that once I set the blinking property of my control to true the blinking background comes to the foreground covering the caption. (If the caption is wider than the control itself then the part which is outside of the control remains visible.) Same if I use an indicator.

 

Is this a bug? Is there any workaround to keep the caption in the foreground while blinking?

 

thanks! 

 

0 Kudos
Message 1 of 9
(1,199 Views)

You say "String Control", but I assume you mean "String Indicator", i.e. you want to display (not read) a String (but, if you mean Control, you can probably do something similar).  You can center text horizontally in a String Indicator by using the "Center" Justification setting on the Indicator.  You can position the text vertically by placing NewLines in front of it before displaying it.  For example, if your Indicator is 5 lines tall and you want to display a single line, prepending two NewLines before writing to the Indicator will center it vertically.

Centered Text.png

0 Kudos
Message 2 of 9
(1,177 Views)

Nope, I am saying its true for both controls and indicators. The method you have described will not center the text vertically if the control/indicator has 5 lines and your text has 4 lines not to mention that its not dynamic so if you change the length of the text you may need to revise the number of empty line which is a pain in the back when you write the control/indicator several times in your code. Also what if you change the size of the control/indicator? Have to revise everything again... 

 

 

New findings about the ORIGINAL problem:

  • Blinking hides the label as well if it is in front of the control
  • Same behaviour if I disable the control
  • Blinking hides neither the label nor the caption if it the control itself is "disabled and grayed out", but in this case the caption gets grayed as well.

 

 

0 Kudos
Message 3 of 9
(1,166 Views)

OK, so you are not using the Control as a "Control" (since if you have a Caption displayed in it, how are you going to enter text?).  You are also worried about multiple lines of text, including more lines than will fit into the Control/Indicator.

 

Well, the text has a size (defined by the number of lines and the size of the Font), and the Control (I'll use "Control" to mean "Control or Indicator") has a Size, so you could figure out the size of your text and adjust the size of the Control to fit it as "snugly" as you wish (using the extra line trick if you want space).

 

Bob Schor

0 Kudos
Message 4 of 9
(1,145 Views)

I forgot to mention that this is only for displaying texts, kind of a status display. (Its correct the user wont be able to interact with the text except reading it)

 

Positioning the text based on the font wouldn't be easy at all. And even if I can calulate the entire height of my text, how would I center it vertically if lets say the control has 5 lines and my text has 4? Adding a newline in the textbox with a different font size? Nah, that stinks.

 

So instead I just position the caption to the center of the control (or indicator, doesnt matter). This can be done easily by using the "position" and "bounds" properties of the control and "position" and "bounds" property of it's caption.

 

And at this point we go back to the problem I have mentioned and why I have filed this topic: if make the control blinking the caption and the label gets covered by the blinking background of the control except if I disable and gray it out but in this case the centered caption gets grayed out as well.

0 Kudos
Message 5 of 9
(1,129 Views)

@1984 wrote:

I forgot to mention that this is only for displaying texts, kind of a status display. (Its correct the user wont be able to interact with the text except reading it)

 

Positioning the text based on the font wouldn't be easy at all. And even if I can calulate the entire height of my text, how would I center it vertically if lets say the control has 5 lines and my text has 4? Adding a newline in the textbox with a different font size? Nah, that stinks.

 

So instead I just position the caption to the center of the control (or indicator, doesnt matter). This can be done easily by using the "position" and "bounds" properties of the control and "position" and "bounds" property of it's caption.

 

And at this point we go back to the problem I have mentioned and why I have filed this topic: if make the control blinking the caption and the label gets covered by the blinking background of the control except if I disable and gray it out but in this case the centered caption gets grayed out as well.


For goodness sake, if you are talking about an Indicator, just make it an Indicator (instead of jamming a value into a String Control, which perverts the whole point of having Controls (to read from) and Indicators (to write to).  And if the Indicator has 5 lines and your text has 4, then resize the Indicator to have 4 lines!  Duh.  Note that if you want the "center position" of the Indicator to remain unchanged, you can also adjust its Position.  All this is how the Indicator was designed to be used.  You are trying to do something that it was not designed to do, namely to use the Caption property as the "Value" of the Indicator, and find that (by design) it doesn't do what you want it to do.  OK, so use the Indicator in the manner for which it was designed, and stop complaining ...

 

Bob Schor

0 Kudos
Message 6 of 9
(1,117 Views)

You could put a free text label in front of the "control".  This may be somewhat difficult because you can only access it thru the Pane Decorations array (at least in 2012) and I believe the items are indexed in the array based on the order of creation.

aputman
LabVIEW 2017
LabVIEW Programming
0 Kudos
Message 7 of 9
(1,108 Views)

You may not get bothered by the fact that an element on you UI constantly changes its size, but most people dont like this.

 

I have asked a simple question: can I get rid of the blinking hiding the label / caption. Adding the fact that its true for BOTH indicators and controls is just and extra piece of information letting the people know that it is true for both. I am not even sure why did you start to answer a question I have not asked.

0 Kudos
Message 8 of 9
(1,099 Views)

This bit of code requires the Lava UI Tools on VIPM for snapping to center. 

Example_VI_BD.png

aputman
LabVIEW 2017
LabVIEW Programming
0 Kudos
Message 9 of 9
(1,085 Views)