drag drop file from Window Explorer to smalltalk pane

This is a discussion on drag drop file from Window Explorer to smalltalk pane within the Smalltalk forums in Programming Languages category; Hi, everyone. I have a problem to create a tool to read file path dragged on my form! I receive a WinDragDropSession object from drag/drop event after create WinDragDropObject object after obtain a IDataObject object. If I try to see available formats from WinDragDropObject I cant see 'CF_HDROP' only Set('FileName' 'DragContext' 'InShellDragLoop' 'Shell IDList Array' 'Shell Object Offsets' 'DragImageBits' 'FileNameW' ) whose contain a OLE interface. Can you help me to solve my problem? A lot of thanks for your attention to my problem...

Go Back   Application Development Forum > Programming Languages > Smalltalk

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 08-15-2008, 09:43 AM
vsedletskiy@gmail.com
Guest
 
Default drag drop file from Window Explorer to smalltalk pane

Hi, everyone.

I have a problem to create a tool to read file path dragged on my
form!
I receive a WinDragDropSession object from drag/drop event after
create WinDragDropObject object after obtain a IDataObject object.
If I try to see available formats from WinDragDropObject I cant see
'CF_HDROP' only Set('FileName' 'DragContext' 'InShellDragLoop' 'Shell
IDList Array' 'Shell Object Offsets' 'DragImageBits' 'FileNameW' )
whose contain a OLE interface.

Can you help me to solve my problem?

A lot of thanks for your attention to my problem
Reply With Quote
  #2  
Old 08-15-2008, 04:47 PM
Udo Schneider
Guest
 
Default Re: drag drop file from Window Explorer to smalltalk pane

> Can you help me to solve my problem?
The following blog post might help:
http://readthesourceluke.blogspot.co...ia-native.html

CU,

Udo
Reply With Quote
  #3  
Old 08-15-2008, 05:45 PM
vsedletskiy@gmail.com
Guest
 
Default Re: drag drop file from Window Explorer to smalltalk pane

Thanks for answer, but it my mistake I using a Digitalk Release 3.1

When I try to see a Objects that Clipboard contain it show me a nil

Here a my code:

dragTargetDrop: aSession
| dragObject iDataObject formatEtc cfFormat stgMedium iStream |

dragObject := aSession objects first.
iDataObject := dragObject formats at: 'FileNameW' ifAbsent: [nil].
iDataObject notNil ifTrue: [
iDataObject canCreateLinkedObject ifTrue: [

cfFormat := Clipboard registerFormat: 'FileNameW'.
formatEtc := OLE_FORMATETC format: cfFormat medium: 1.

(iDataObject hasGetDataFormat: formatEtc) ifTrue: [

formatEtc lindex. 0.
stgMedium := iDataObject getData: formatEtc.

]
]
]

Maybe some thing wrong with a code
Reply With Quote
  #4  
Old 08-17-2008, 12:27 PM
James Foster
Guest
 
Default Re: drag drop file from Window Explorer to smalltalk pane

On Aug 15, 2:45*pm, "vsedlets...@gmail.com" <vsedlets...@gmail.com>
wrote:
> Thanks for answer, but it my mistake I using a Digitalk Release 3.1
> Maybe some thing wrong with a code


Actually, if you are using Digitalk Smalltalk 3.1 then you are posting
to the wrong newsgroup. This newsgroup is for Dolphin Smalltalk.
Questions for Digitalk should be posted to the more general
comp.lang.smalltalk and/or to the mailing list dedicated to Digitalk.
Go to http://www.listserv.dfn.de/cgi-bin/wa?SUBED1=vswe-l&A=1 to
subscribe to that mailing list and/or view the archives.

James Foster
Reply With Quote
  #5  
Old 08-18-2008, 06:20 AM
Udo Schneider
Guest
 
Default Re: drag drop file from Window Explorer to smalltalk pane

> I receive a WinDragDropSession object from drag/drop event after
> create WinDragDropObject object after obtain a IDataObject object.
> If I try to see available formats from WinDragDropObject I cant see
> 'CF_HDROP' only Set('FileName' 'DragContext' 'InShellDragLoop' 'Shell
> IDList Array' 'Shell Object Offsets' 'DragImageBits' 'FileNameW' )
> whose contain a OLE interface.

I think I got you wrong. AFAIK you won't get the file contents via DnD
from Explorer - only the filename.

The filename(s) are available as format 'Filename' and you are
responsible for reading it on your own. So in VSE Pseudocode ... :

dragTargetDrop: aSession
| dragObject filename stream contents |

dragObject := aSession objects first.
filename := dragObject formats at: 'FileNameW' ifAbsent: [nil].
stream := FileStream open: filename.
[contents := stream contents] ensure: [stream close].
"Do whatever you want with the filenames and/or content" ...

CU,

Udo
Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 11:17 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.