LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

a couple of questions about listboxes

Hi guys,

as in the thread title, I have a couple of questions about listboxes.

 

1) When the user double-clicks on a listbox item, I write an empty array to the 'ItemNames' property and a '-1' costant to the 'Value' one. But the listbox refreshes in an unexpected way: a small grey rectangle is displayed at the position where the user double-clicked (see attached screenshot.jpg, and listbox_test.vi to reproduce the behaviour)

 

2) I'm able to edit a cell clicking on it twice (with a short pause between the clicks). But can I use a front panel button to have the same effect? (i.e. can I use a button to give the focus to a selected cell?). I played a lot with the'Allow Editing Cells' and 'Edit row' without success. You can look the attached listbox_test.vi to see what I did.

 

I've been using LabVIEW 8.2.1 on WinXP pro

 

Thanks in advance

Vix
-------------------------------------------
In claris non fit interpretatio

-------------------------------------------
Using LV from 7
Using LW/CVI from 6.0
Download All
0 Kudos
Message 1 of 5
(2,633 Views)

vix wrote:

1) When the user double-clicks on a listbox item, I write an empty array to the 'ItemNames' property and a '-1' costant to the 'Value' one.


OK... Why would you do this? This makes no sense.

 


But the listbox refreshes in an unexpected way: a small grey rectangle is displayed at the position where the user double-clicked (see attached screenshot.jpg, and listbox_test.vi to reproduce the behaviour)


This indeed seems to be a graphics artifact. It's probably due to the fact that you're modifying the listbox in the middle of an event for it. If you used a separate "Clear" button (which makes more sense than using a double-click event) and cleared the items in the "Value change" event for this button you wouldn't see the artifact.

 


2) I'm able to edit a cell clicking on it twice (with a short pause between the clicks). But can I use a front panel button to have the same effect? (i.e. can I use a button to give the focus to a selected cell?). I played a lot with the'Allow Editing Cells' and 'Edit row' without success. You can look the attached listbox_test.vi to see what I did.

You need set the Boolean constant to True. Smiley Wink

 

0 Kudos
Message 2 of 5
(2,621 Views)

smercurio_fc wrote:

OK... Why would you do this? This makes no sense.

 


In my project I use the listbox to browse an archive which has a parent/child structure. When the user double-clicks on one item, I fill in the listbox with the item children names. If the item has no children, I must empty the listbox, and so I use the empty array strings constant. Moreover I want that no items are selected, and so I use the '-1' costant. I thought this was the simplest way to do what I need...

The same graphical behaviour happens also if I use a non-empty string array (item with some children opended): the position previously selected has that gray rectangle.

 


smercurio_fc wrote:

 

...

If you used a separate "Clear" button (which makes more sense than using a double-click event) and cleared the items in the "Value change" event for this button you wouldn't see the artifact.

 


Yes, I've already noticed, but I use the "Double click" event for the reason I explained.

For example, I noticed that If I move the right scrollbar, the listbox is refreshed and the rectangle disappear, but I don't know how I can use this...

Have you got any suggestion?

 


smercurio_fc wrote: 

 

You need set the Boolean constant to True. Smiley Wink

 


I don't know how I can miss this.... what a shame.....

 

Vix
-------------------------------------------
In claris non fit interpretatio

-------------------------------------------
Using LV from 7
Using LW/CVI from 6.0
0 Kudos
Message 3 of 5
(2,614 Views)
If you have a parent-child structure perhaps you should consider using a tree control, as it's suited for that task. In your example, how does one go back to the parent? There seems to be no way of doing this.
0 Kudos
Message 4 of 5
(2,608 Views)

smercurio_fc wrote:
If you have a parent-child structure perhaps you should consider using a tree control, as it's suited for that task.

I know, and I've already developed a project that uses a tree control for this purpose. But fore some reasons, I decide not to use it in this new application.

 


smercurio_fc wrote:
In your example, how does one go back to the parent? There seems to be no way of doing this.

Simply double-clicking over a special item that is in the first row (like the ".." folder)

 

Vix
-------------------------------------------
In claris non fit interpretatio

-------------------------------------------
Using LV from 7
Using LW/CVI from 6.0
0 Kudos
Message 5 of 5
(2,586 Views)