LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

edit XControl Data using double click on one of its components

Hello,

 

I would like to build an XControl based on an MulticolumnListBox. Double clicking should open an additional window for editing several columns of the selected line.

The data to be displayed is hidden in the State Ability of the XControl while the actual Data is an Integer indication the selected line.

 

Writing data to the control using properties or methods works fine. But editing using a pop up window does not have the right data.

 

What did I wrong?

 

Please find attach the XControl as far as I got.

 

Best regards

 

0 Kudos
Message 1 of 8
(2,639 Views)

In the posted Zip file is a control missing. I have fixed this and added a test VI (It's in the MyMCListBox Subdirectory).

 

Many apologies for any inconveniences

0 Kudos
Message 2 of 8
(2,629 Views)

Hi Jörn,

thanks for posting to our forums. 

 

Unfortunately, there are still two files missing: the popup window "Werte Auswahlfenster.vi" and "Findings III Control.ctl". Could you please post these files, as well?

 

Thanks and best regards, 

Peter

--
Peter A.
Field Sales Engineer, NI Germany
0 Kudos
Message 3 of 8
(2,614 Views)

Hi Peter,

 

I am really sorry about that.

 

Please find attached a corrected Zip file.

 

A related question is: How can I access parts of the XControl Data (e. g. one element of a cluster or an array) using methods or properties?

This would help me as well.

 

Regards

Jörn

0 Kudos
Message 4 of 8
(2,611 Views)

Hi Jörn,

The problem you are is seeing is due to being off by 1 when indexing the Werte array.  In the Table: Mouse Down event in the facade of the XControl, you index the Werte array at array size.  This means that the array is being indexed at a value that is not initialized, so it creates a new value using the default.

 

To fix this, insert a decrement function between the Array Size function and the comparison Less or Equal.  This will index the correct element in the array to modify.

 

Regards, 

Peter

--
Peter A.
Field Sales Engineer, NI Germany
0 Kudos
Message 5 of 8
(2,594 Views)

Hi Peter,

 

you are right. The indexing is not correct.

 

But the property "Active Cell" seems not to work properly. I supposed that it returns the indices of the cell which I click/activate with the mouse.

What is the use of this property?

 

Regards

 Jörn

0 Kudos
Message 6 of 8
(2,579 Views)

Hey,

 

This property will be used to set the active cell.

To read the position you will need to use a mouse down or click event.

 

The following forums post is discussing this and you will find a little event-based example at the end of the first page.

-> http://forums.ni.com/ni/board/message?board.id=170&requireLogin=False&thread.id=117712

 

 

Christian

0 Kudos
Message 7 of 8
(2,564 Views)

The point is that active cell property does not return the row and column of the cell where the user clicked (regardless the event which is evaluated). Active cell property is used to select the cell(s) which should be altered by setting e.g. background color or font. My assumption was wrong and the documentation is not clear enough. One needs some algorithm to calculate the row and column of the clicked cell from the mouse position inside the multicolumn listbox as well as the cell widths and cell heights (now using the active cell property to read witdh and height of all cells).

 

On the other hand a table control can provide the activated cell usind the property is named Selection Start but it doesn't provide highlighting of the selected row.

 

Jörn

0 Kudos
Message 8 of 8
(2,557 Views)