TreeView Control 
Author Message
 TreeView Control

I am working on an app that includes a TV Control. I populate the control
with files and folders. I'm not populating the control using FSO.

From the nodes you can rename files and folders, you can add and delete
folders. The only thing that I can't figure out is the functionality to
delete files and here is why:

In the before label edit I have a routine that checks to be sure the user
isn't trying to modify, rename, delete a folder that I don't want modified,
renamed or deleted. Works great.

In the after label edit I have a routine that checks whether NewString is
empty and if it is cancel = true and exits the routine leaving everything in
the before editing started position. If NewString is not empty then the
routine continues to allow renaming of files and folders. Works great.

I have a dblclick event that if a file is clicked with open the file. If it
is a folder a dialog opens prompting for adding a new folder or deleting the
folder that was double clicked. Works great as far as it goes.

The problem is that I also want users to be able to delete files (as they
can with folders) and it seems I've used up all my options? Maybe I haven't
structured this right. I tried by adding an if...else to test the contents
of NewString and checking for file extensions but I can't seem to get
anything to work. I can't create a new dialog for the files because they
already have a dblclick event, before and after label edit events and using
a single click event might be annoying everytime you clicked on a node which
is why the node click event won't work either.

Any pointers would be appreciated.

Thanks,

--
Vikki



Wed, 21 May 2003 03:00:00 GMT  
 TreeView Control
No I hadn't thought of that.  I got stuck in thinking of click events. :o)

Thank you, I'll try it out!

--
Vikki



Thu, 22 May 2003 03:00:00 GMT  
 TreeView Control
Have you considered using the KeyPress event and trapping the "Delete" key
(KeyCode=46) and deleting the file?

--
Al Reid


Quote:
> I am working on an app that includes a TV Control. I populate the control
> with files and folders. I'm not populating the control using FSO.

> From the nodes you can rename files and folders, you can add and delete
> folders. The only thing that I can't figure out is the functionality to
> delete files and here is why:

> In the before label edit I have a routine that checks to be sure the user
> isn't trying to modify, rename, delete a folder that I don't want
modified,
> renamed or deleted. Works great.

> In the after label edit I have a routine that checks whether NewString is
> empty and if it is cancel = true and exits the routine leaving everything
in
> the before editing started position. If NewString is not empty then the
> routine continues to allow renaming of files and folders. Works great.

> I have a dblclick event that if a file is clicked with open the file. If
it
> is a folder a dialog opens prompting for adding a new folder or deleting
the
> folder that was double clicked. Works great as far as it goes.

> The problem is that I also want users to be able to delete files (as they
> can with folders) and it seems I've used up all my options? Maybe I
haven't
> structured this right. I tried by adding an if...else to test the contents
> of NewString and checking for file extensions but I can't seem to get
> anything to work. I can't create a new dialog for the files because they
> already have a dblclick event, before and after label edit events and
using
> a single click event might be annoying everytime you clicked on a node
which
> is why the node click event won't work either.

> Any pointers would be appreciated.

> Thanks,

> --
> Vikki



Fri, 23 May 2003 09:39:38 GMT  
 TreeView Control
You can also check for a rightclick and popup a popupmenu to allow for
deleting - as well as other operations. Check for rightclick by saving the
mousebutton possibly along with the shift status) in a form public variable
captured in the TV mousedown event. This state can then be tested in the
nodeclick event.


Quote:
> I am working on an app that includes a TV Control. I populate the control
> with files and folders. I'm not populating the control using FSO.

> From the nodes you can rename files and folders, you can add and delete
> folders. The only thing that I can't figure out is the functionality to
> delete files and here is why:

> In the before label edit I have a routine that checks to be sure the user
> isn't trying to modify, rename, delete a folder that I don't want
modified,
> renamed or deleted. Works great.

> In the after label edit I have a routine that checks whether NewString is
> empty and if it is cancel = true and exits the routine leaving everything
in
> the before editing started position. If NewString is not empty then the
> routine continues to allow renaming of files and folders. Works great.

> I have a dblclick event that if a file is clicked with open the file. If
it
> is a folder a dialog opens prompting for adding a new folder or deleting
the
> folder that was double clicked. Works great as far as it goes.

> The problem is that I also want users to be able to delete files (as they
> can with folders) and it seems I've used up all my options? Maybe I
haven't
> structured this right. I tried by adding an if...else to test the contents
> of NewString and checking for file extensions but I can't seem to get
> anything to work. I can't create a new dialog for the files because they
> already have a dblclick event, before and after label edit events and
using
> a single click event might be annoying everytime you clicked on a node
which
> is why the node click event won't work either.

> Any pointers would be appreciated.

> Thanks,

> --
> Vikki



Fri, 23 May 2003 03:00:00 GMT  
 TreeView Control
Maybe using popup menu with right click on file like in explorer?


Fri, 23 May 2003 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. TreeView :Flicker in TreeView-control

2. Putting a treeview control on a Tab control page

3. VB TreeView Control and Tab Control with NT4 SP4

4. Using the treeview control/downloading the control to clients

5. TreeView Control with ListView Control

6. Overlay 2 icons in ImageList control to assign to Treeview control node image

7. VB fails to use common control properly (Treeview control)

8. how to resize the treeview control or msflexgrid control when runing

9. Crashing when using treeview control (comctl32.ocx) inside multipage control (FM20.dll)

10. Using the treeview control/downloading the control to clients

11. Using Treeview control in Access97

12. Alternate treeview control for Access 2000?

 

 
Powered by phpBB® Forum Software