11-19-2008 09:24 AM
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
Solved! Go to Solution.
11-19-2008 09:53 AM - edited 11-19-2008 09:54 AM
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.:
11-19-2008 10:03 AM
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
11-19-2008 10:13 AM
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
11-19-2008 10:17 AM
11-19-2008 10:21 AM
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
11-19-2008 11:21 AM
11-19-2008 11:32 AM
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.