Drag and Drop from Windows Explorer to Smalltalk Image

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Drag and Drop from Windows Explorer to Smalltalk Image

Alex Greber
Hello everyone.
Is it possible to drag a file from a windows explorer to a smalltalk image an get the file name in smalltalk?
Regards Alex

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Drag and Drop from Windows Explorer to Smalltalk Image

Louis LaBrunda
Hi Alex,

I think the answer is yes.  VA Smalltalk supports drag and drop.  When defining drag and drop for a widget (generally a container of some sort) you specify either "Image Drag Drop Spec" or "Platform Drag Drop Spec".  You would want "Platform Drag Drop Spec".  "Image Drag Drop Spec" is for dragging and dropping things (rows or whatever) from within the VA Smalltalk program.  "Platform Drag Drop Spec" I expect is for dragging and dropping things that are outside you program.  I have used "Image Drag Drop Spec" (it works fine) but don't remember using "Platform Drag Drop Spec" but I think it should work so give it a try.  Good luck!

Lou

On Thursday, July 23, 2015 at 1:12:24 PM UTC-4, Alex Greber wrote:
Hello everyone.
Is it possible to drag a file from a windows explorer to a smalltalk image an get the file name in smalltalk?
Regards Alex

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Drag and Drop from Windows Explorer to Smalltalk Image

Julian-2
I have actually tried that...using the Platform Drag Drop Spec, but have never been able to get that to work.
Alex, have you had any luck with this?
I would very much like to be able to drag a file from windows explorer....

Regards,
Juilan

On Friday, 24 July 2015 09:13:06 UTC-4, Louis LaBrunda wrote:
Hi Alex,

I think the answer is yes.  VA Smalltalk supports drag and drop.  When defining drag and drop for a widget (generally a container of some sort) you specify either "Image Drag Drop Spec" or "Platform Drag Drop Spec".  You would want "Platform Drag Drop Spec".  "Image Drag Drop Spec" is for dragging and dropping things (rows or whatever) from within the VA Smalltalk program.  "Platform Drag Drop Spec" I expect is for dragging and dropping things that are outside you program.  I have used "Image Drag Drop Spec" (it works fine) but don't remember using "Platform Drag Drop Spec" but I think it should work so give it a try.  Good luck!

Lou

On Thursday, July 23, 2015 at 1:12:24 PM UTC-4, Alex Greber wrote:
Hello everyone.
Is it possible to drag a file from a windows explorer to a smalltalk image an get the file name in smalltalk?
Regards Alex

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Drag and Drop from Windows Explorer to Smalltalk Image

Marten Feldtmann-4
In reply to this post by Alex Greber
Yes, its possible - though I've only be able to transfer ONE file at a time. There has been a change in the Drag&Drop Protocol in the Windows history ... the one-file approach is the old protocol (and you you get short file names).

The following code parts are around 15 years old and I took this from an old repository:

startTransfer: callData targetTypes: targetTypes clientData: clientData

    ""

    | dropTransfers |

    dropTransfers := OrderedCollection new.

    targetTypes do: [ :target |
        dropTransfers add:
            (CwDropTransferEntry
                target: target
                transferClientData: clientData) ].
    callData dragContext   
        dropTransferStart: [ :dropTransfer |
            dropTransfer
                dropTransfers: dropTransfers ;
                transferProc:
                    (CwCallbackRec
                        receiver: self
                        selector: #transferProc:clientData:callData:
                        clientData: callData) ].


and

transferProc: aCwDropTransfer clientData: dopProcCallData callData: callData
    ""

    callData value isNil ifTrue: [^self].
    self asyncExecInUI: [
        self handleSelectedFile: (
            CfsPath named:
                ( PHXOperatingSystemServices    longFilenameFromShortPath: (String abtFromPointer: callData value)))]


and:

nativeFilenameDrag: aWidget clientData: clientData callData: callData

    callData
        operation: XmDROPCOPY ;
        dropSiteStatus: XmDROPSITEVALID


and:

nativeFilenameDrop: aWidget clientData: clientData callData: callData

    self startTransfer: callData targetTypes: #('FileName') clientData: self docRenderingsWidget




Am Donnerstag, 23. Juli 2015 19:12:24 UTC+2 schrieb Alex Greber:
Hello everyone.
Is it possible to drag a file from a windows explorer to a smalltalk image an get the file name in smalltalk?
Regards Alex

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Drag and Drop from Windows Explorer to Smalltalk Image

Julian-2
Thanks for posting the code, Marten.
How is it used?
Are these the handlers for Drag/Drop events?

Sorry if I am missing the obvious, but can you indicate how this code is used?

Thanks!

Regards,
Julian

On Sunday, 3 April 2016 03:29:25 UTC-4, Marten Feldtmann wrote:
Yes, its possible - though I've only be able to transfer ONE file at a time. There has been a change in the Drag&Drop Protocol in the Windows history ... the one-file approach is the old protocol (and you you get short file names).

The following code parts are around 15 years old and I took this from an old repository:

startTransfer: callData targetTypes: targetTypes clientData: clientData

    ""

    | dropTransfers |

    dropTransfers := OrderedCollection new.

    targetTypes do: [ :target |
        dropTransfers add:
            (CwDropTransferEntry
                target: target
                transferClientData: clientData) ].
    callData dragContext   
        dropTransferStart: [ :dropTransfer |
            dropTransfer
                dropTransfers: dropTransfers ;
                transferProc:
                    (CwCallbackRec
                        receiver: self
                        selector: #transferProc:clientData:callData:
                        clientData: callData) ].


and

transferProc: aCwDropTransfer clientData: dopProcCallData callData: callData
    ""

    callData value isNil ifTrue: [^self].
    self asyncExecInUI: [
        self handleSelectedFile: (
            CfsPath named:
                ( PHXOperatingSystemServices    longFilenameFromShortPath: (String abtFromPointer: callData value)))]


and:

nativeFilenameDrag: aWidget clientData: clientData callData: callData

    callData
        operation: XmDROPCOPY ;
        dropSiteStatus: XmDROPSITEVALID


and:

nativeFilenameDrop: aWidget clientData: clientData callData: callData

    self startTransfer: callData targetTypes: #('FileName') clientData: self docRenderingsWidget




Am Donnerstag, 23. Juli 2015 19:12:24 UTC+2 schrieb Alex Greber:
Hello everyone.
Is it possible to drag a file from a windows explorer to a smalltalk image an get the file name in smalltalk?
Regards Alex

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Drag and Drop from Windows Explorer to Smalltalk Image

rjuli...@gmail.com
In reply to this post by Alex Greber
I know this is an old thread now...but I have still not managed to get this to work.
Does anyone have a working example of this?

Thanks!

Julian

On Thursday, July 23, 2015 at 1:12:24 PM UTC-4, Alex Greber wrote:
Hello everyone.
Is it possible to drag a file from a windows explorer to a smalltalk image an get the file name in smalltalk?
Regards Alex

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Drag and Drop from Windows Explorer to Smalltalk Image

jtuchel
In reply to this post by Marten Feldtmann-4
I used this as a template to get filenames and got it to work ("somehow...").


Things to note:
  • The target type 'FileName' is key here, but it is not documented in the Programmer's reference. (how did you find out, are there more than STRING, BITMAP and FileName?)
  • As Marten notes, dropping multiple files doesn't work. Is this just a question of using another targetType?
  • As Marten notes, this only retruns short file names (C:\MYPATH~1\). This works, but it is a workaround that's about 20 years old...

How would one implement dragging files from the Windows Explorer to a VAST App in the 21st century? (note that I am not using CompEditor in this project but WB Pro).



Joachim






Am Sonntag, 3. April 2016 09:29:25 UTC+2 schrieb Marten Feldtmann:
Yes, its possible - though I've only be able to transfer ONE file at a time. There has been a change in the Drag&Drop Protocol in the Windows history ... the one-file approach is the old protocol (and you you get short file names).

The following code parts are around 15 years old and I took this from an old repository:

startTransfer: callData targetTypes: targetTypes clientData: clientData

    ""

    | dropTransfers |

    dropTransfers := OrderedCollection new.

    targetTypes do: [ :target |
        dropTransfers add:
            (CwDropTransferEntry
                target: target
                transferClientData: clientData) ].
    callData dragContext   
        dropTransferStart: [ :dropTransfer |
            dropTransfer
                dropTransfers: dropTransfers ;
                transferProc:
                    (CwCallbackRec
                        receiver: self
                        selector: #transferProc:clientData:callData:
                        clientData: callData) ].


and

transferProc: aCwDropTransfer clientData: dopProcCallData callData: callData
    ""

    callData value isNil ifTrue: [^self].
    self asyncExecInUI: [
        self handleSelectedFile: (
            CfsPath named:
                ( PHXOperatingSystemServices    longFilenameFromShortPath: (String abtFromPointer: callData value)))]


and:

nativeFilenameDrag: aWidget clientData: clientData callData: callData

    callData
        operation: XmDROPCOPY ;
        dropSiteStatus: XmDROPSITEVALID


and:

nativeFilenameDrop: aWidget clientData: clientData callData: callData

    self startTransfer: callData targetTypes: #('FileName') clientData: self docRenderingsWidget




Am Donnerstag, 23. Juli 2015 19:12:24 UTC+2 schrieb Alex Greber:
Hello everyone.
Is it possible to drag a file from a windows explorer to a smalltalk image an get the file name in smalltalk?
Regards Alex

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Drag and Drop from Windows Explorer to Smalltalk Image

Marten Feldtmann-5


Am Dienstag, 20. März 2018 18:50:31 UTC+1 schrieb Joachim Tuchel:
I used this as a template to get filenames and got it to work ("somehow...").


Things to note:
  • The target type 'FileName' is key here, but it is not documented in the Programmer's reference. (how did you find out, are there more than STRING, BITMAP and FileName?)
  • As Marten notes, dropping multiple files doesn't work. Is this just a question of using another targetType?
I think its a matter of a newer internal protocol ...
  • As Marten notes, this only retruns short file names (C:\MYPATH~1\). This works, but it is a workaround that's about 20 years old...

How would one implement dragging files from the Windows Explorer to a VAST App in the 21st century? (note that I am not using CompEditor in this project but WB Pro).



Joachim






Am Sonntag, 3. April 2016 09:29:25 UTC+2 schrieb Marten Feldtmann:
Yes, its possible - though I've only be able to transfer ONE file at a time. There has been a change in the Drag&Drop Protocol in the Windows history ... the one-file approach is the old protocol (and you you get short file names).

The following code parts are around 15 years old and I took this from an old repository:

startTransfer: callData targetTypes: targetTypes clientData: clientData

    ""

    | dropTransfers |

    dropTransfers := OrderedCollection new.

    targetTypes do: [ :target |
        dropTransfers add:
            (CwDropTransferEntry
                target: target
                transferClientData: clientData) ].
    callData dragContext   
        dropTransferStart: [ :dropTransfer |
            dropTransfer
                dropTransfers: dropTransfers ;
                transferProc:
                    (CwCallbackRec
                        receiver: self
                        selector: #transferProc:clientData:callData:
                        clientData: callData) ].


and

transferProc: aCwDropTransfer clientData: dopProcCallData callData: callData
    ""

    callData value isNil ifTrue: [^self].
    self asyncExecInUI: [
        self handleSelectedFile: (
            CfsPath named:
                ( PHXOperatingSystemServices    longFilenameFromShortPath: (String abtFromPointer: callData value)))]


and:

nativeFilenameDrag: aWidget clientData: clientData callData: callData

    callData
        operation: XmDROPCOPY ;
        dropSiteStatus: XmDROPSITEVALID


and:

nativeFilenameDrop: aWidget clientData: clientData callData: callData

    self startTransfer: callData targetTypes: #('FileName') clientData: self docRenderingsWidget




Am Donnerstag, 23. Juli 2015 19:12:24 UTC+2 schrieb Alex Greber:
Hello everyone.
Is it possible to drag a file from a windows explorer to a smalltalk image an get the file name in smalltalk?
Regards Alex

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Drag and Drop from Windows Explorer to Smalltalk Image

jtuchel
In reply to this post by jtuchel
I'd be interested in understanding the code a little better. The code shown in the Programmers' Reference and the sample provided by Marten are somewhat confusing to me. You register a few callbacks and finally in the last callback you get some info in callData that's not been there in the methods that have previously been called.... Where can I find more about this handling of drag&drop events in ancient Windows APIs? How do the parts work together and what is happening inbetween the callbacks?

I guess I'd have to dig for some documentation from Windows 95 or earlier to understand all this? Any pointers? Maybe there is miore to learn like additional targetTypes?

And then: is there any current plan to support more recent drag&drop standards, like getting "real" paths, dropping multiple files etc.?



--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Drag and Drop from Windows Explorer to Smalltalk Image

Alex Greber
This is an example I got from Instantiations. (see attachment)



Am Mittwoch, 21. März 2018 07:14:07 UTC+1 schrieb Joachim Tuchel:
I'd be interested in understanding the code a little better. The code shown in the Programmers' Reference and the sample provided by Marten are somewhat confusing to me. You register a few callbacks and finally in the last callback you get some info in callData that's not been there in the methods that have previously been called.... Where can I find more about this handling of drag&drop events in ancient Windows APIs? How do the parts work together and what is happening inbetween the callbacks?

I guess I'd have to dig for some documentation from Windows 95 or earlier to understand all this? Any pointers? Maybe there is miore to learn like additional targetTypes?

And then: is there any current plan to support more recent drag&drop standards, like getting "real" paths, dropping multiple files etc.?



--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.

manager58944.dat (58K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Drag and Drop from Windows Explorer to Smalltalk Image

jtuchel
In reply to this post by jtuchel
With the help of a colleague I found out that there is 'FileDrop' and 'FileNameW'. And we found out that 'FileName' has been deprecated by MS a while ago.

So...

Trying FileNameW, we get into troubles because the (full) filename is in UTF-16, but we couldn't find a way to convert UTF-16 to the local code page (819 in our case) - any tips? The ByteArray in  callData value starts with 67 0 (which I guess is the Drive Letter 'C', but trying to use AbtCodepAgeConverter for 'UTF-16', 1200 or 1201 results in a primitive failed).

Trying FileDrop, the callData value is nil, so there either need to be more modifications to the code in order to get multiple file names or this simply doesn't work in VA. Has anybody had more success with this?

Joachim

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.