treeview list drag and drop on the nodes

I

iccsi

I would like to have drag and drop function to limit on certain nodes
for my tree view list node for example, courses nodes can move to
students nodes, but not professor modes. The list is like following


- Dept
-Prof1
- Student1
- course1
- course2
- Studrent2
-course3


I tried to use index of nodes to limit, but the index conitunes to
different level of nodes.

Are there any property to identify Prof level and Student level of
nodes?
Is Tag only place to go?

Your information is great appreciated,
 
I

inungh

Use the KEY for each node to differentiate the Node type and Level.  Then
when there is a drop on a node, test the key and if the move is not allowed
then have code saying such otherwise have the code do the change that is
requested.

You can add your something like "D1" to the front of the Dept Node Key, "P1"
& ProfID to the Prof Node, "S1" & StudID to the Student Node and so forth..
When the drop is made test the "left 2" (or whatever schema you create) and
have code to select and test if the drag node "left 2" is allowed to be
droped on the drop node.

We actually store various info in the Key and use a TaggedValues routine to
separate.  For example we write a Purchase Order to a node using "PO=" &
PONumber & "|Vendor=" & VendorID and Purchase Order Detail on a node that is
a tvwChild related to the PO Node and it is something like "POD=" & PODNumber
& "|ProductID=" & ProductID  and so forth

The TagedValues routine separates the various values and give back the values
for the "text" you wish.

Tagged Values is great and can be found
From Access 2000 Developer's Handbook, Volume I
' by Getz, Litwin, and Gilbert (Sybex)
' Copyright 1999.  All rights reserved.

So, you can then retrieve and save the initial Drag values and then save the
Drop values and then test conditionally as to whether you can do something or
not.

so your test is somethign like

MouseDown Event
NodKey = trvw.HitTest(x, y).Key 'module declared

in the DragDrop event

Dim tvDrag As New TaggedValues
Dim tvDrop As New TaggedValues '

If NodKey = trvw.DropHighlight.Key Or NodKey = "Root" Then GoTo exithere
'trying to move the "Dept" in your example or the drop node match the drag
node

tvDrag.Text = NodKey
tvDrop.Text = trvw.DropHighlight.Key










--
DS

Message posted via AccessMonster.comhttp://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200904/1- Hide quoted text -

- Show quoted text -

Thanks millions,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top