09-03-2008 09:32 AM
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
09-03-2008 10:02 AM
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.
09-03-2008 10:28 AM
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.
I don't know how I can miss this.... what a shame.....
09-03-2008 10:43 AM
09-04-2008 01:13 AM
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)