LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Get the active cell in a table on a mouse click, so I can change its color

Solved!
Go to solution

Hi guys,

I am looking at a small application.

I  have a table. When a user clicks on a particular cell, I need the cell coordinates so that I can change its attributes (e.g. color change) by clicking a button.

Edit position property of the table gives me the current cell coordinates, but when I click on a button, the previously clicked cell position is lost. How can I fix this problem?

Is there a way to solve this problem?

 

Thanks

Ravi

0 Kudos
Message 1 of 8
(10,623 Views)

Use the Mouse Up event and the use the Point to Row Column method to get your cell. You can use the In Bounds? output to distinguish whether the click was on a cell or not (like on the scrollbar). E.g.:

 

Message Edited by smercurio_fc on 11-19-2008 09:54 AM
Message 2 of 8
(10,613 Views)

Thanks for the reply. But, Iam trying to avoid using event structures for someother reason in my code. Is there a way, this could be done without event structures.

 

Please look at the code attached. Whenever the value in the table goes beyond 100, i want to click on the corresponding cell and then suspend it by using the suspend button, in which case the backgroud color should change to red.

 

Thanks

0 Kudos
Message 3 of 8
(10,604 Views)

rpula wrote:

Thanks for the reply. But, Iam trying to avoid using event structures for someother reason in my code. Is there a way, this could be done without event structures.

 

Please look at the code attached. Whenever the value in the table goes beyond 100, i want to click on the corresponding cell and then suspend it by using the suspend button, in which case the backgroud color should change to red.

 

Thanks


 

Saverio's suggestion to use an event structure is a good one so rather than exploring less efficient methods, could you please explain why you are avoiding teh use of an event structure? This will help us help you.

 

Just trying to help,

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 4 of 8
(10,595 Views)
I don't quite understand why you don't want to use the event structure either, and looking at your code I don't understand how it's supposed to work. How to the values get changed? Does the user enter the value? What does the Suspend button have to do with this?
0 Kudos
Message 5 of 8
(10,590 Views)

My software needs to run continuously over long periods of time displaying the data in the table. Data in the table is read from the sensors which may change the value. Sometimes the number looks unrealistic (e.g. 125 in the table), so I need to suspend it for alarms and change its cell color indicating the sensor is suspended.

Now, I suspect if I use an event structure, it keeps waiting for a mouse click event and doesnt display the data continously over time. Also, I want other features of the software to be working continously without waiting for a mouse click event.

This was the only reason why I thought of not preferring event structures. Now, my perception might be wrong. Please correct if so.

 

Thanks 

0 Kudos
Message 6 of 8
(10,587 Views)
Solution
Accepted by topic author rpula
Guys, I got it working. Thanks for the comments.
Message 7 of 8
(10,555 Views)

That is not a solution. In fact, you've just made things worse by creating a race condition with those local variables.

 

Your premise on the limitation of event structures is incorrect. An event structure will sit and wait for an event to occur if the Timeout input is left unwired. If you want the event case to do something periodically, then you wire a value to the Timeout input. Then, the Timeout case will be executed if no events have occured within that amount of time. A better solution would be to use a producer-consumer architecture. 

Message 8 of 8
(10,546 Views)