Drag and Drop Change File Attributes

If you are using wxDev-C++ for your wxWidgets design, please ask your questions here instead of in IDE Related.
Post Reply
papayrus
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 204
Joined: Tue Jan 25, 2011 4:55 pm
Location: USA
Contact:

Drag and Drop Change File Attributes

Post by papayrus » Mon Sep 26, 2011 10:15 am

Hello I am trying to make a panel on a frame that I can drop files on to unhide them after they were hidden by usb viruses for quick repair on usb files that were damaged by the virus.

All I have so far is code to change a files attributes I am not sure how to make the panel so I can drag and drop the files on it and execute the code on those files. Here is the code I have as a basis.

Code: Select all

WinExec("attrib -H D:\\New\\*.* /S /D", SW_HIDE);
This seems to do the job but like I said would be cool if I can drag all the hiddens docs into a panel and have it execute that code on the files for quick repair.
Thanks in advance for any help.

Edit:
That code I mean unhides all the files in the directory called New. It would be just as great to be able to drag a whole directory of the hidden files as well. Either way will do great.

papayrus
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 204
Joined: Tue Jan 25, 2011 4:55 pm
Location: USA
Contact:

Re: Drag and Drop Change File Attributes

Post by papayrus » Tue Sep 27, 2011 5:42 pm

Anyone can help here? I am looking to make a code on a panel that in english would be something like.

If file dragged and dropped onto panel1 then clear the hidden attribute.

Mainly I need help with getting the drag and drop of the file to work with the panel then I need the drop of the file on the panel to trigger the clear hidden attribute of the file dropped. Any help here it is not a major important thing just a project I decided to create.

Thanks again.

User avatar
doublemax
Moderator
Moderator
Posts: 14990
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Drag and Drop Change File Attributes

Post by doublemax » Tue Sep 27, 2011 5:54 pm

Check the "dnd" sample that comes with wxWidgets. It shows everything you need for this.

wxFileDropTarget:
http://docs.wxwidgets.org/stable/wx_wxf ... droptarget
Use the source, Luke!

papayrus
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 204
Joined: Tue Jan 25, 2011 4:55 pm
Location: USA
Contact:

Re: Drag and Drop Change File Attributes

Post by papayrus » Tue Sep 27, 2011 6:16 pm

Yes I did check it out but I get confused on how to impliment it on a panel if that is even possible.

Sorry got confused here I just found about about dialogblocks and am trying it but I got the full package that comes with the mingw compiler and the wxwidgets install but the thing is I already have wxpack installed and code blocks has mingw installed already so I am trying to figure out if I need to install wxwidgets again in another directory and mingw again because I don't think it will let me use the mingw that is installed with code blocks.
Last edited by papayrus on Tue Sep 27, 2011 6:31 pm, edited 2 times in total.

User avatar
doublemax
Moderator
Moderator
Posts: 14990
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Drag and Drop Change File Attributes

Post by doublemax » Tue Sep 27, 2011 6:23 pm

Any wxWindow can be a drop target.

Take the class DnDFile from the dnd sample as a start.

Call wxWindow::SetDropTarget on your panel.
http://docs.wxwidgets.org/stable/wx_wxw ... droptarget
Use the source, Luke!

papayrus
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 204
Joined: Tue Jan 25, 2011 4:55 pm
Location: USA
Contact:

Re: Drag and Drop Change File Attributes

Post by papayrus » Tue Sep 27, 2011 6:29 pm

Ok thanks for the two links I will get reading on it and see what I can come up with here. I'll let you know what I come up with code if I can't get it to work properly.
Thanks again.:)

Post Reply