Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Image Dragging & Dropping

Status
Not open for further replies.

stanlyn

Programmer
Sep 3, 2003
945
US
Hi,

Using VFP9sp2, I need some pointers on the layout of a drag & drop VFP application.

The application is an "Accounts Payables" module that contains images of invoices. The images will be scanned into an "InTray" which would contain invoices for multiple vendors. I plan to use a "seperator" page to indicate all the pages that pertains to a single multi-page invoice during the scanning process. At this point they have not been assigned to any AP record.

I want to drag those images into its related vendor treeview folder node, while renamng the image and creating the AP record all in the same drop process.

Another option I'd like to do is... lets say that the left side of the form contains the data for an invoice such as InvDate, amount, and terms, as well as an drop area that would receive the images dragged in from the InTray. What vfp object would I use for the drop area. Also note that this all needs to be done inside the vfp app, and not from explorer.

I've been playing around with the OLE drag & drop pems a bit.

Anyone done this sort of stuff before?

Also note that this destined to SQL server a little later on...

Any ideas, suggestions are highly encouraged.

Thanks, Stanley
 
Hi clipper01,

Looks good, however I don't see any vfp examples...

I've spent the last 30 minutes trying to tie together the folder and file viewers together with no luck. I've tried:

thisform.FolderV.FileView = thisform.FileV.WindowHandle
thisform.FolderV.FileView = thisform.FileV.Name
thisform.FolderV.FileView = thisform.FileV

Any idea?
 
There are OLE and native drag & drop samples in the foxpro samples. One way to go there is Task Pane -> Solution Samples

search for drag.

Try "Fun with OLE drag&drop" and especially the the editbox with the caption "Drop Files here from Windows Explorer".

Look at the source code of that sample form by clicking on the icon at the right side of the Task Pane/Solution Samples search result entry.

You talk of dragging from an "InTray". Well, what is it? Some source control embedded in UI of your scanner program showing the latest image scans, or just some specific folder with image files?

Bye, Olaf.
 
Stanley,

What you are describing is definitely possible, but your question is a bit too general.

If you have no idea where to start with drag-and-drop, you should read the Help topics first. There's plenty of information there, as well as in the samples that come with VFP.

If you have already tried doing drag-and-drop but have got stuck, let us know what specific difficulties you are having.

One initial tip: VFP supports two systems for drag-and-drop. The one that you should focus on is called OLE Drag and Drop (the other is "native" drag and drop, which is very limited, and does not support dropping outside the original container).

Also, you asked what control you should use to receive the dragged invoices. Based on what you've told us so far, I'd say a Container control would be appropriate.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Stanley, yr correct , no VFP sample , but the chm help file has all u need ,be glad to send any help.

Here is a "Hello World " example, in a few lines of code , you have a full explorer interface active in yr VFP form

1) create a form and drag a FolderView and Fileview object on
2)*** in the Init of the form
thisform.FolderView.rootfolder="c:\"
thisform.refresh


3) *** FolderView event OnAfterNodeSelect
LPARAMETERS node
thisform.FileView.currentfolder=this.selectednode.path
thisform.refresh

4) ** sample FileView event OnItemClick
LPARAMETERS item, x, y
messagebox (upper(this.firstselecteditem.path))


regards Sean M
 
follow-up to previous

1) u first added objects called FolderView FileView
2) now add objects FolderView2 , FileView2
3) edit the init and event handlers to do similar for these
4) now just drag/drop from folder to fileview or folder to folder or fileview to fileview

That I think is more or less what u spec'ed

there may be some way to do what Mike/Olaf are talking about , but I suspect that is just dropping from a regular explorer control which is not what u need ( plus , it seems with ole/vfp to be very problematic to drop anything other than plain text).

If this is going to make a sale of your project , it will be a very cheap spend to buy the shell controls
 
Stanlyn,

reading your initial post a little closer.

I still don't understand what your drag source is, but you say "this all needs to be done inside the vfp app, and not from explorer".

As of that: If you're still interested in doing drag&drop without a third party add on, Mike is still right in recommending to concentrate on ole drag&drop, as that is supported both for native VFP controls and ActiveX controls you may use as treeview.

You ask what control to use as a drop target, but you say you want the user to drag images to a treeview folder node, then you have your drop target already, don't you?

Another reason to use ole drag&drop with such a treeview, as that must be an ActiveX Treeview, foxpro has no native treeview. Whatever is your vendor folder treeview node can be your drop target. Any VFP control and more so any ActiveX control offers the OleDragDrop methods and properties. You're not limited to anything in that respect.

Sean is right, that the main thing you can easily drag&drop are texts, but with oledrag&drop you can put whatever you like inside the oDataObject parameter. Using a format as "VFP Source Object", this can even be a VFP object, a control reference (eg THIS inside OleDragStart), a form, a record scattered to an object via NAME clause or whatever. And what you put into the oDataobject via oDataObject.SetData() in OleDragStart will be received in OleDragDrop.

Putting in the image file name would be sufficient, wouldn't it? Knowing that in the drop and knowing the node dropped on you know the image, the vendor and you can Move the image file, add a record referencing the moved image file and also display it as a node (depending on the capabilites of the control you use).

Bye, Olaf.
 
If this is going to make a sale of your project , it will be a very cheap spend to buy the shell controls

I really don't think Stanley needs to buy any third-party controls. The built-in drag-and-drop is flexible enough to do what he wants - including dropping on a treeview, which is one of his possible requirements.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Hi Mike , Stanley has it seems, downloaded the trial version. Not sure what he bills per day , but this little spend will save a lot of days work , if he wants to implement what he has described, believe me :). His call , I guess !!
 
clipper,

I certainly agree, that a third party control could amortise fast. Last time I did drag&drop I used oDataObject successfully, using collection objects in it, which by my own definition of my own custom drag&drop protocol had a first item always denoting what kind of data to find, so I could easily decide in the Drop event, whether to accept or deny processing the dragged data, even more so, if there was not one of my self defeined collection objects in the drag data.

This way it was easy to drag&drop different node types in and out of a treeview.

It took me a while, though. I will check, whether the shell megapack controls make that easier. I doubt the drag&drop process itself is done so much differently, even though there certainly is potential even in the plain normal ole drag&drop, strting from as easy as only setting OleDragMode automatic up to as complicated as needing code in most Ole Drag&Drop events.

Controls, which automatically do the things you want from the drag operation are certainly easier to use.

At the point it comes to do things like Stanley wants, it's hardly done with an automatic mode of some control, whioch most probable is DBF unaware:

-drag those images into its related vendor treeview folder node, while renaming the image and creating the AP record all in the same drop process.

You need code in a Drop event to do this, and you need code in dragstart to put the data in you need at the drop event. And that's about all you need to program with ole drag&drop anyway.

The only thing activex controls can deliver on top of that rather is functionality to show somethings as the ideal drag sources or targets for your type of data.

If it's files, actually that could be as easy as a webbrowser control you navigate to a path. It's just beyond me to easily define the look of the webbrowser from detail list to image previews.

Bye, Olaf.
 
intersting take , Olaf. U might be interested to download the shell pack , it integrates seamlessly with the VFP form , has a very complete set of events.methods etc. I've used it in lots of projects, paid for itself many times over ( the hello world code I sent to Stanley is a quick kick-off) . Be interested to know your comparison to vfp ole

sean m
 
Hi Olaf,

>> You talk of dragging from an "InTray". Well, what is it? Some source control embedded in UI of your scanner program showing the latest image scans, or just some specific folder with image files?

The InTray most likely will be a folder on the OS, unless someone presents a better way... Just remember that I'm in the exploration phase of this project, looking for all the options and the difficulty of implementing each. These brain storming sessions, followed by my researching them will help narrow the spec...

So brain storm away,
Stanley
 
Hi Mike,

> What you are describing is definitely possible, but your question is a bit too general.

Mike, its general because I'm fishing on ideas on hoe to implement this...


I have played around with the OLE version and can see this as part of the solution.

> Also, you asked what control you should use to receive the dragged invoices. Based on what you've told us so far, I'd say a Container control would be appropriate.

OK, Olaf's reference to the solutions samples refers to an editbox. So far, I've not looked at it, but would assume that either would work. I'm actually wondering what PEMs would be involved on the container or editbox that recieved the dragged images.? Please explain... The answer may be in the solution samples that I haven't got to yet.

Thanks, Stanley
 
Hi Sean,

> Here is a "Hello World " example, in a few lines of code , you have a full explorer interface active in yr VFP form.

Yes, I've gotten that far and it does seem easy enough with plenty of PEMS. BTW, I was unable to get the 3rd component "shcombobox" to work. What does it do and is it important?

And, what property contains the currently selected node?

Thanks,
Stanley
 
To All,

> it seems with ole/vfp to be very problematic to drop anything other than plain text).

Is this true?

Thanks, Stanley

 
Hi Sean,

> Not sure what he bills per day , but this little spend will save a lot of days work , if he wants to implement what he has described, believe me :). His call , I guess !!

Purchasing the 3rd party controls is NOT a problem, and this one actually is very usefully in other areas as well, plus no royalties...

I will be purchasing this at the end of the trial, so we can count this as in our toolkit for this project if needed...

Thanks, Stanley
 
stanley ,

the currently selected node is got from the folderview selectedNode object. This returns a TreeNode object , this is where u manipulate anything u want. Go to the CHM help file and look up the TreeNode reference.

So the path to current node is folderView.SelectedNode.Path

I've not used the combobox control, it's mainly a drive-selection dialog , but u have that anyhow in the folder control

 
Hi Olaf,

> At the point it comes to do things like Stanley wants, it's hardly done with an automatic mode of some control, whioch most probable is DBF unaware:

> -drag those images into its related vendor treeview folder node, while renaming the image and creating the AP record all in the same drop process.

> You need code in a Drop event to do this, and you need code in dragstart to put the data in you need at the drop event. And that's about all you need to program with ole drag&drop anyway.

Yes, that sums it up what I was thinking, and thanks for the clarity. However, at this point, I may be overlooking something by not having my spec correct. By encouraging any and all ideas on creating a stunning intutive interface for this AP app, I hope to settle on a "well thought out" spec. So please, lets continue talking.

Thanks, Stanley
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top