LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to blink a single element in an array of string

Hi,

 

I am working on array blinking option in an array of string. I wanted to blink each element of array in different instances.

 

Ex: I have array as MyArray [5] = { "aaaa", "bbbb", "cccc", "dddd", "eeee"}. Question is i want to blink one by one, first 0th row, next 1st row and so on.

 

Could any one please help on this.

 

Many Thanks

Hanee..

0 Kudos
Message 1 of 16
(5,896 Views)

As far as I am aware, what you do to one element will happen to all in an array.

 

An alternative option is to use a cluster of strings. You can access an array of control references and act on them individually. This can be made to look like an array, but of course may not fit with the rest of your code.

blink strings.png

0 Kudos
Message 2 of 16
(5,886 Views)

You cannot acces the properties of a single element into an array.

Rodéric L
Certified LabVIEW Architect
Message 3 of 16
(5,874 Views)

Hi,

 

You can use the reference of your perticular string element in your array.

Just pass the reference to blinking property.

May be this is not the standard way to do coding, but you can achive the target by using this.

 

Thanks and Regards

Himanshu Goyal

Thanks and Regards
Himanshu Goyal | LabVIEW Engineer- Power System Automation
Values that steer us ahead: Passion | Innovation | Ambition | Diligence | Teamwork
It Only gets BETTER!!!
Download All
0 Kudos
Message 4 of 16
(5,869 Views)

@Himanshu Goyal wrote:

Hi,

 

You can use the reference of your perticular string element in your array.




Weird - I could have sworn I tried that and it didn't work... just tried it again and it did!  Smiley Surprised

 

You have to be a little careful with this method - try stopping and starting the code a few times and you'll see what I mean. Its possible to inadvertently change the colour of all the elements if the blinking property is not reset before the code next runs.

I guess its also a little harder to programmatically choose which element you wish to blink unless you manually create an array of references which is indexed. It would certainly work but could be a pain if you want to increase the size of the array later on.

 

EDIT: Actually, no this does not work.... the element that is blinking is the last one that was clicked on.

click an element - run the code.

Now click another one and run again..... a different element blinks.

 

 

0 Kudos
Message 5 of 16
(5,863 Views)

Hi lan

 

You are right. I miss this bug.

Thanks and Regards
Himanshu Goyal | LabVIEW Engineer- Power System Automation
Values that steer us ahead: Passion | Innovation | Ambition | Diligence | Teamwork
It Only gets BETTER!!!
0 Kudos
Message 6 of 16
(5,843 Views)

Simple rule:

The elements of an array share all attribute values except one: the 'value' attribute.

 

So, since "blinking" is not the attribute "value", either all or none of the elements are blinking.

 

hope this helps,

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 7 of 16
(5,825 Views)

@Norbert B wrote:

Simple rule:

The elements of an array share all attribute values except one: the 'value' attribute.

 

So, since "blinking" is not the attribute "value", either all or none of the elements are blinking.

 

hope this helps,

Norbert


 

Straying slightly off-track here, but this doesn't seem to fit with what I'm seeing. Himanshu Goyal's code can certainly be used to make just one element blink... it just can't control which one (hence the initial suggestion of using a cluster instead).

Whats happening there?

 

Thanks,

Ian

 

 

 

0 Kudos
Message 8 of 16
(5,820 Views)

Ian,

 

i cannot tell you what's happening here. Fact is, that this is not the way to go. See attached example.

 

If you run it and click into one of the string fields (mouse up event!) you will see, that "Cell" Value changes. If you look into the code, you see that i read the string form the String refnum, so it seems to handle the "Active Cell". But writing to it (Set Color) will reveal, that the whole array will change its background color. This matches my statement.

 

I really fo not understand, why reading from the same string refnum yields different results ("Active Cell"???!), but regarding blinking: setting this for a single "Cell" will set it for all "Cells", but due to graphical updates (same as buttons&event structures), it is only visible in the "Active Cell". Rest asured, that the property value "blinking" is true for all "Cells" then (even thought not graphically visible).

 

hope this helps,

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 9 of 16
(5,803 Views)

Hanee,

 

Since you cannot blink an individual element in an array, how can you get a similar result to what you asked originally?  Use two arrays.  One array contains your data {"aaaa, ...}.  The second array is an array of color boxes.  You make the background of the data array transparent.  You resize the color box array elements to match the size of the elements of the data array and move the color box array behind the data array.  This can be tedious but is doable.  The select two colors for the color boxes. One is probably the same as the normal background color of the indicator.  The other is a color which will appear when "blinking." It should have enough contrast to the text to allow the data to be read.  Then you alternately write the background color and the "Blink" color to the color box array element where you want to simulate blinking.  Since you are writing data to the color box array, you can set each element independently.

 

Lynn

Message 10 of 16
(5,770 Views)