TOPIC: drag and drop into OpenImageControl
#548
drag and drop into OpenImageControl 3 Years, 7 Months ago
For a while I have thought it would be nice to be able to drag & drop files into OpenImageControl. For example, if I save a screenshot on my desktop it would be nice to just drag it into our bug tracking system instead of having to find it with an Open File dialog.

The first step is to call DragAcceptFiles to specify that your control will accept dropping files. I added an option to ImageControl for this.

The next step is to handle the WM_DROPFILES message. I added a method for this, also in ImageControl, that simply Send's "ImageDropFiles".

In OpenImageControl, I added a method for ImageDropFiles that retrieves the file name(s) using DragQueryFile.

Dropping one file is simple, but what if you drop several? On a lot of our screens we have multiple OpenImageControl's to allow users to have several "attachments". It would be nice if you could drop multiple files. Since an individual OpenImageControl can not handle multiple files, I made it Send "ImageDropFileList". If no parent control handles this, then the drop is refused.

Then I created an AttachmentControl "container" (a PassthruController) that can be wrapped around a group of OpenImageControls to handle placing the multiple files into multiple OpenImageControl's.

Note: All the API calls had to be added to stdlib.

It seems to work pretty well. For a change, I did not run into any weird Windows issues.

I have attached a file you can Import into stdlib - I have not tested it in the release version but I think it should work. Let me know if there are any problems.

File Attachment:
File Name: imagedrag.txt
File Size: 11465


Post edited by: andrew, at: 2007/01/14 23:23
 
 
andrew
 
#549
Re:drag and drop into OpenImageControl 3 Years, 7 Months ago
A very nice feature! But how can I import that file in my lib? 'Import Records' doesn't work for me...
 
 
Mauro
 
#552
Re:drag and drop into OpenImageControl 3 Years, 7 Months ago
I just tried downloading it (right-click and save) and Import Records works fine for me. What kind of error do you get?

Here is a zip version to try also.
File Attachment:
File Name: imagedrag.zip
File Size: 3718
 
 
andrew
 
#555
Re:drag and drop into OpenImageControl 3 Years, 7 Months ago
Sorry, it works... :blush: It was that the LibraryView didn't refresh immediately the records in the left treeview when I imported the txt file. To see the new added methods, I had to close and reopen the library folder in which I have imported the file.
 
 
Mauro
 
#558
Re:drag and drop into OpenImageControl 3 Years, 7 Months ago
Sweet, thats exactly what I was looking for!

Z

BTW MDILib isnt compatible with current version of suneido, am working on a fix....