LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Disable Double Click Behavior on Tree Expand

Solved!
Go to solution

Thanks for the tip, that does help but adds another issue that I have a solution for.  If I double click a parent item, I can use the CellPart to tell me what part was double clicked and if it was the Open/Close Symbol to do nothing. 

 

The only problem I see is that the the Expand/Colapse event is triggered before the double click event.  So I don't have a way of knowing if the Expand/Collapse should be discarded until after the event has taken place.  So what this means is you'll double click a parent item, and it will Close or Open, and then the dialog comes up.  The only solution I came up with so far is to read the state of the Close/Expand and invert it after a double click.This causes a slight blip in a quick close and open on the UI if you double click a parent but I'm okay with it since the code is much simpler.

 

Example_VI_BD.png

Message 11 of 15
(2,014 Views)

This seems like a great case for a Qcontrol to encapsulate all of the filtering, opening, closing, etc.

0 Kudos
Message 12 of 15
(1,998 Views)
Solution
Accepted by Hooovahh

Thread necromancy!

 

I found this thread as I was trying to figure out how to disable the double-click to expand/collapse functionality in a Tree Control. I still want users to be able to click the expand/collapse symbols, but I don't want to expand/collapse if they double-click anywhere in the tree.

 

I ultimately stumbled upon this really simple solution that I thought I would describe here, as I didn't see anyone else mention it. The Double Click method of the TreeControl class gives you the tag of the last item that was double-clicked:

 

dc.png

 

This essentially gives us the information from the 'Double Click' event while we're in the Item Open?/Item Close? filter event, so we can know if the Item Open/Close was fired as the result of a double-click. If it was, I can simply discard the event (so the item isn't opened/closed, and then immediately after this diagram executes, the Double Click event fires). I tested it quite a bit and it looks like the method is pretty good about not giving back stale data, i.e. tags that were double-clicked previously before an Item Open/Close happens.

Message 13 of 15
(1,906 Views)

Darren's solution works well except for when the user is clicking directly on the expand/collapse symbol rapidly.

This produces a "double click" event, when the user was really just trying to expand/collapse the tree rapidly.

Pretty niche, but also noticeable and undesirable.

0 Kudos
Message 14 of 15
(1,520 Views)

That could be addressed at the OS level by adjusting the speed of the double click (in the Mouse settings)

0 Kudos
Message 15 of 15
(1,506 Views)