LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using Array of Cluster as a FP mixed Data Type Table, issues with deleting selected row

Solved!
Go to solution

Hello All,

I am using a 1D array of clusters to act as an user editable front panel table and found a handy community VI that helps me determine which row in the array that the user clicked on here.  I added buttons to add/delete row but need some help with some specific event logic.

 

Here is a quick mock up of what I am doing:

FP_ClusterTable.png

I want a case in which when the user clicks on a row then clicks away anywhere else on the front panel the row selection is forgotten, so when I go hit the delete button it will delete the last row instead of the selected row.  This logic seems straight forward but I can't seem to figure out how to get it to work.  I tried to do an mouse down event on the pane to reset the row selection, but that event gets triggered event if I click on a front panel buttons, so will end up making every delete a delete last row action.

 

Is there a way to get the delete button to be dual purpose, delete last row and delete based on user selection, or do I need to make 2 delete buttons to make this work?

 

Regards,

Mike

 

 

0 Kudos
Message 1 of 4
(2,765 Views)

Hi Mikejj,

 

I want a case in which when the user clicks on a row then clicks away anywhere else on the front panel the row selection is forgotten, so when I go hit the delete button it will delete the last row instead of the selected row.

  • Use a table instead of an array: Create an event case to detect mouse-clicks in the table and use a method of the table to convert mouse coordinates to row/column in the table. Store the "row" value in a shift register. (When you insist on using an array you need to provide your own algorithm to convert mouse position to row/column…)
  • Create another event case detecting mouse-clicks in the frontpanel. Set the "row" value in the shift register to a default value to indicate "delete last row"…
  • I prefer listboxes as they give the selected rows as their value…
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 4
(2,758 Views)

Hi GerdW:

From you suggestions I have 2 questions:

1.) If I use a table, can I still have a mixture of datatypes as I currently have with an array of clusters?

2.) As I mentioned, if I handle a mouse-down even on pane, it hi-jacks all my front panel mouse down clicks, even on my add and delete row buttons.  So when I actually do want to delete a selected row by clicking on a cell and moving the mouse to click on my delete button, it won't work because it will set the row value to "delete last row". 

 

Regards,

Mike

0 Kudos
Message 3 of 4
(2,727 Views)
Solution
Accepted by topic author Mikejj

Hi Mikejj,

 

1. A table (or listbox) only takes strings as input (or displayed data). You would need to convert between your internal data storage and the UI display…

2. Another approach: create a large button and place it in the background of all other UI controls. Now you can detect mouse events on your UI controls in the front and differ from the button in the background… (Unfortunately there still is no LostFocus event…)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 4
(2,723 Views)