From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Mouse down event handling of table control in subvi

Hello Everyone.......

 

I have created a vi which has a table control and xy graph... the function of the vi is to plot the data of two particular column of table into xy-graph after user selects the data from table....  In this vi , I have used mouse down event for selecting data set so that the color of selected row get changed for user reference.......  the vi is working fine..... 

My problem is that this vi is a part of main vi.. and I want to use this vi as a subvi.... So, in my main vi I have a table control which is connected as input to the subvi...  I come to know that I need to register event for triggering a event in a subvi.......

 

(1) How to register Mouse down event of table control which is on Main Vi to trigger mouse down event of table in subvi.... Another Important thing is... how to link every property of table control of subvi to the table control of main vi... so it just act as single control adapting every property like when user selects a particular row its color changes in subvi....so it should be reflected even if user selects a row in main vi... I mean table control of main vi and subvi should be a single control...is it possible?

 

I hope I am clear......Thanks ..

0 Kudos
Message 1 of 7
(3,436 Views)

It's not 100% clear what you're asking for but if I get the jyst of it you need to use control references and pass them into the SubVI. Right click on the table control and select 'create -> reference' and then you can pass this wire into the SubVI to be able to read/write the properties of the table from within your SubVI. You can also wire this reference to a Register for Events node to register for events on the table control within your SubVI.

 

As far as your second point regarding having property changes reflected on two controls, I don't think it's possible (but I may be wrong...). You should be able to do something close to what you want with the method above of passing the references of both controls into an event handler (but I would probably more likely use user events that are registered for in both VIs and when an event happens on one control, generate it on the other).


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 2 of 7
(3,431 Views)

Thanks Sam...

 

Let me ask this way.... How to create table control which is unique for main vi and subvi...... I mean event created like mouse down from main vi can trigger the event structure of table in subvi... and color changed registered in subvi can be seen on main vi front panel table control......  I mean any property of the that single table control is seen in both vi.....

 

I hope I am clear this time.....Thanks again........

0 Kudos
Message 3 of 7
(3,426 Views)

I don't think it's possible to simply apply all property changes from one control to another (this could have some seriously undesirable effects...). You will need to pass the references around and apply the change from one table control to the other at the same time. From the sounds of it you just want to update the column colours so it shouldn't be too much of a problem.

 

If you need the table control reference from the SubVI in the Main VI then you can store this in an FGV (Functional Global Variable / Action Engine). Set the reference within the SubVI and read it from the main VI. You could use this FGV to store both references to make it simpler to program but you may need to do some error handling in case the reference hasn't been set for the table control in the SubVI yet.

 

In reality, what I would do is use a common VI for the table control, spawn multiple instances of it and load each one into subpanels on the main VI and the Sub VI. I would share a user event between the instances so when an event occurs in one, you can fire the user event and apply the change to the other controls - this is fairly advanced though and requires more thought on how to initialise / shutdown the UI elements.


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 4 of 7
(3,412 Views)

Thank a lot.......... These terms are very new for me... I am attaching a vi with table control and mouse down event... Can you just show me by example your method?... It will be great help......

0 Kudos
Message 5 of 7
(3,398 Views)

See the modified version of the VI. I use the 'Point to Row Column' method to get the cell that was clicked on - your method also worked using 'Selection Start' but I thought I'd show you an alternative.

 

I've used a single event structure to update two table controls - the point is that if you have the references to the controls you can update the control from anywhere. You can also 'register for events' to allow you to register for events from a different VI (again, using the references) that doesn't have the control on the front panel.

 

Couple of things about your VI:

You don't need to put a wait node if you have a timeout on your event structure.

You don't need the for loop for the columns/rows - if you look at the help for the 'Active Cell' property you can use a value of -2 for the row/column to select all cells in the row/column.


LabVIEW Champion, CLA, CLED, CTD
(blog)
Message 6 of 7
(3,383 Views)

Thanks a lot......... I will try emulate this by puting one of the table in subvi and one in main vi  and try to see if they match each other..... 

Thanks again......

0 Kudos
Message 7 of 7
(3,373 Views)