03-14-2013 08:51 AM
LV 2010, Win 7
I have a Drag and Drop interface where the user drags various items from part of the window onto a MultiColumn ListBox, in order to construct a spreadsheet-like result.
The format they construct is remembered and they can apply it to many data files in the future.
They can also drag rows around to re-arrange them, and drag columns around too, once they're placed.
It's all working fine, EXCEPT:
If the text in a given listbox cell is longer than the cell's width, the text is partially hidden. That's fine.
If you move the mouse over the cell, something like a "tip-strip" opens up and displays the complete text. That's fine.
BUT
That tip strip interferes with dragging something. When you click, you're clicking on the STRIP, not on the listbox.
As a result, the DRAG STARTING? event never gets called and so you cannot drag.
You can see it in this JING :
I drag a few items onto the sheet OK.
I can drag the DURATION line down and put it somewhere else.
But I cannot drag the item with the strip on it.
Notice that I CAN drag that line, by grabbing the number that has no strip covering it. (My code allows you to drag a row by clicking anywhere on the row except the symbol).
If you try hard you can move the mouse onto a cell, click before the strip comes up, and drag it just fine.
So, the code is working fine.
I've verified that DRAG STARTING? is not getting called, if there's a strip under the mouse.
What can I do about this? I haven't found a way to turn off this strip. Indeed, it's useful.
But I don't think it's a control that I can get events from.
So I've no way of knowing whether it's up or not.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
Solved! Go to Solution.
03-14-2013 10:37 AM
This VI seems to work just fine in 2011 - I get the time no matter which element of the MCLB I drag. I back saved it to 2010.
03-14-2013 11:32 AM
Hmmm. Your VI seems to work OK in LV 2010.
I changed the event to Drag Starting?(like my real code).
I changed the MCLB to Allow DROPPING as well (like my real code).
It still works.
Yet my code doesn't work.
If I stretch the size of column 1 to where the strips don't appear, it works.
If I stretch the size of column 1 to where one row has a strip and another doesn't, I can drag the one that doesn't, but not the one that does.
If I shrink column 1 to where they all have a strip, then they all fail to drag.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
03-14-2013 11:37 AM
OK, it has to be something ELSE, then.
I copied MY listbox and plugged it into YOUR test VI and it works as you would expect.
I DO get DRAG STARTING? events.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
03-14-2013 11:46 AM
Well, I put a time display on my code, and it does NOT get a DRAG STARTING? event if the strip is up.
See this JING
the Numeric down below is just the EVENT time for DRAG STARTING?
It flat out DOES NOT get an event if the strip is up.
Notice that I shrunk column 1 and the ones that did work do not any longer.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
03-14-2013 11:57 AM
I do have a MOUSE DOWN? event on this same control, with the ability to discard the event.
But that's not happening - I put a light on the DISCARD? signal and it's not lit during this trouble.
(If you click on the SYMBOL, the row is deleted and the click event is discarded).
I am NOT getting a DRAG ENDED event.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
03-14-2013 12:14 PM
I don't have much experience with D/D events, but I would still suspect the Mouse Down? event, even if you don't see discarding. You could try removing the event or changing the order of the events in the structure to see if that changes it. I would also suggest trying to remove other events if that doesn't do it until you get to a point where the code does work. Then you know which event is the culprit.
03-14-2013 12:43 PM
Disabling everything INSIDE the MOUSE DOWN? event does nothing for it.
Rearranging the event order does nothing for it.
Now doing a backup and I'll pull the event out completely....
Blog for (mostly LabVIEW) programmers: Tips And Tricks
03-14-2013 12:59 PM
YES!
Removing the MOUSE DOWN? event altogether lets it work.
I have verified that it does work without it.
If the event is there but everything is disabled, it does NOT work.
I have verified that the MOUSE DOWN? event is NOT being discarded.
I don't understand that, but there it is.
Why did you suggest rearranging the event order? On the face of it, that should have no effect (and it didn't).
Have you had trouble before where that fixed it?
I've asked NI for an explanation of why there is a SORT function on the REARRANGE EVENT CASES, but they were unable to explain how it sorted them, or why I should care.
The purpose of my MOUSE DOWN? code is twofold:
1... If it's a mouse-down in the HEADER row, and it's in a column > 1, then I add/subtract this column from the column selection (you can shift-click or control click to select multiple columns). and then discard the event.
2... Otherwise, if it's a mouse-down in the SYMBOL for this row, it's a DELETE request (the symbol is an "X") , and I discard the event.
Otherwise the event is NOT discarded.
It's not like I can live without that event.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
03-14-2013 01:14 PM
You can see the same behavior in tst's example if you add a Mouse Down? event and hardcode a false to it. Curiously, creating a Mouse Down (non-filtering) event does not cause this issue. And, as you said, the Mouse Down? event doesn't cause a problem as long as the tip strip doesn't show itself.