LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

TreeView

I'm playing about with using treeviews in Labview via ActiveX. I can
populate them to as many levels as I want, add icons, have them expand and
contract and use the ActiveX events to tell when nodes are
clicked/expanded/contracted etc. However I'm at a loss as to how to drag
nodes about. I've set OLEDragMode to Automatic and OLEDropMode to Manual (as
opposed to "none") and I can click on icons and drag them. However no
ActiveX events appear to be generated when I do this and there appear to be
no properties or methods of any of the objects that help. Needless to say,
the control itself doesn't seem to automatically handle the re-arrangement.

I've found the "HitTest" method of the TreeView object, but that appears to
be designed on the assumption it will be used
in a callback function in a
C++ program, and that Windows will supply the current X and Y coordinates to
this function of the icon being dragged- clearly not a great deal of use
here.

Has anyone managed to get full control of the TreeView control within
Labview or am I going to have to accept that I don't have drag+drop?


--
Craig Graham
Physicist/Labview Programmer
Lancaster University, UK
0 Kudos
Message 1 of 7
(3,701 Views)
The events in charge are OLEDragOver and OLEDragDrop (sometimes you need OLEGiveFeedback too).
Use first one to change highlighted node and the second one to do the re-arrangement. Unfortunately, you know just x/y mouse pointer coordinates as input and it doesn't seem to be easier to translate them in nodes. You might want to take a look on some VB sites and try to find some sources including this operation (planetsourcecode.com is my hint).
Good luck !
0 Kudos
Message 2 of 7
(3,701 Views)
These aren't events as such in any context other than Visual Basic. They're
simply the names of the Visual Basic functions that, if defined, are called
by Visual Basic when drag and drop operations are in progress. They're like
the callback functions I mention in Visual C++ and have no analogue in
Labview. The x and y mouse coordinates are passed as arguments to these
functions by Windows- they don't actively retrieve the coordinates when
they're called in a way that could be translated to Labview.

Thanks for the suggestion though 🙂 For future reference since you don't
seem to be aware of it, once you HAVE the X and Y mouse coordinates, you can
use the HitTest method of the Treeview object. HitTest takes the coordinates
and returns either a reference
to the node under those coords or "nothing".

Lab Viewer wrote in message
news:506500000005000000F4450000-1002247793000@exchange.ni.com...
> The events in charge are OLEDragOver and OLEDragDrop (sometimes you
> need OLEGiveFeedback too).
> Use first one to change highlighted node and the second one to do the
> re-arrangement. Unfortunately, you know just x/y mouse pointer
> coordinates as input and it doesn't seem to be easier to translate
> them in nodes. You might want to take a look on some VB sites and try
> to find some sources including this operation (planetsourcecode.com is
> my hint).
> Good luck !
0 Kudos
Message 3 of 7
(3,701 Views)
Doh- some eating of words is in order. Although they're not listed in the
list of valid ActiveX events under the Treeview documentation, there are
indeed such events that can be listened for and used to detect drag+drop
operations.

I type corrected 🙂

Craig Graham wrote in message
news:3bc30995@newsgroups....
> These aren't events as such in any context other than Visual Basic.
They're
> simply the names of the Visual Basic functions that, if defined, are
called
> by Visual Basic when drag and drop operations are in progress. They're
like

> Lab Viewer wrote in message
> news:506500000005000000F4450000-1002247793000@exchange.ni.com...
> > The events in charge are OLEDragOver and OLEDragDrop (sometim
es you
> > need OLEGiveFeedback too).
0 Kudos
Message 4 of 7
(3,701 Views)
Glad that you found them 😉
Also, thanks for HitTest hint. I used it once (long time ago) and I wasn't too happy with the results (this is the explanation for my concern regarding x/y-node translation). I've just checked version 6.0 (SP4) and it works great.
Anyway, good luck in your treeview challenge!
0 Kudos
Message 5 of 7
(3,701 Views)
Could anybody show me how to save the treeview
into files, I know how to insert node but don't know
how to retrieve the node from the treeview.
Thanks
0 Kudos
Message 6 of 7
(3,701 Views)
I'm also trying to implement the drag and drop. I have located the events in LabVIEW but I am having trouble trying to use them. Could you send me some example code?
0 Kudos
Message 7 of 7
(3,701 Views)