drag-drop help please....

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

drag-drop help please....

keith
Hi all,
back again for some more help from this great group....
I'm trying to implement drag & drop for a listview on one of my shell
windows. Basically, I want to be able to move an element's position
higher or lower in the list via drag/drop.
In the RC, I've selected "isDragSource" and "isDropTarget" for the
listview.
In my Shell's createSchematicWiring, I've added the following
triggers:
        ( self presenterNamed: 'questionListView' )
                when: #drag
                send: #onDrag
                to: self.
        ( self presenterNamed: 'questionListView' )
                when: #drop
                send: #onDropOver
                to: self.
        ( self presenterNamed: 'questionListView' )
                when: #dragOver
                send: #onDragOver
                to: self.
And in the onDrag method, I've created a new InternalDragDropObject,
and used #format:data: to set the format and data for that object.
My problem: my code doesn't seem to be initiating a DD session. I can
pick up an object (and get the "Not Allowed" cursor), but that's it.
If I set breakpoints in any of my onDragXXX or onDropXXX methods,
execution never halts, so it seems like the wiring from
#createSchematicWiring is ignored. I thought I had everything I needed
to at least trigger the DD event but.....

Any hints or clues as to what I may be doing wrong here?
Sorry for the rambling post -- it's late, I'm tired, and I just can't
seem to find an awful lot of info/documentation on DD with
Dolphin.....

Thanks,

KeithB


Reply | Threaded
Open this post in threaded view
|

Re: drag-drop help please....

Ian Bartholomew-18
Keith,

> Any hints or clues as to what I may be doing wrong here?
> Sorry for the rambling post -- it's late, I'm tired, and I just can't
> seem to find an awful lot of info/documentation on DD with
> Dolphin.....

This is not quite what you asked but might be an alternative ...

If you can use a ListBox rather than a ListView then there is a
WindowsCommonControl called DragList that can do this.  I implemented this
back in the days of Dolphin 3 and have located and extracted the relevant
bits into the attached package.  Just evaluate the following to run the
demo.

Demo show

NB (in big letters).  I've just extracted the methods from the old D3
package and repackaged them for D5.  I haven't checked the code so there
might well, especially as it does some low level windows "stuff", be some
things that now need to be changed - it does appear to work though :-)

Ian






begin 666 draglist.zip
M4$L#!!0````(``%.5BTW/GSMVA(```1(```,````1')A9TQI<W0N<&%C[5M]
M;]LXTO\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0?GL[%VJ+\<@Y:T/M<-,GB.R-YM\4K/"ZN13H*_)?*]=R6>?71G*:\EWUY;C
MR?=>>9=6Q\C0^30E78A*-M5(*<%:;^$*-$I/-OTQB-C,< [ZC3%X1_ :'40N
MX\,1CXHV.N+)_(**X5W0B/"_3?).)D6W-OA4Q#LP+EC^!'C&<O @._6KO%T+
M$2%YYG$!$4CQ;:.IYKA-$J%Y3]2\E6<".F/T5&6TB:NQ+1 F^,]MF6S%"DT&
MN*9;H)"6W42_.\R10:W1V(?02YL9^9_NYQGT?SY6'TCO\.M@]5\'7ZKG:_&E
M\D3__OBR7W S^)3Q96=L=,@WRN>E<JG_XE!ZU'MGGE>.P64,4$:DF3X/C,&_
M#B+]:BX4G6]&I-F(+XM(Y?.UR$&MHH$<:9?U*:2PA>Q,_:T>A4C_BR!H-(6G
M]OJ0?TU$\?]02P$"% L4````" `!3E8M-SY\[=H2```$2 ``# `````````!
K`" `````````1')A9TQI<W0N<&%C4$L%!@`````!``$`.@````03````````
`
end


Reply | Threaded
Open this post in threaded view
|

Re: drag-drop help please....

Christopher J. Demers
In reply to this post by keith
ksbag <[hidden email]> wrote in message
news:[hidden email]...
> Hi all,
> back again for some more help from this great group....
> I'm trying to implement drag & drop for a listview on one of my shell
> windows. Basically, I want to be able to move an element's position
> higher or lower in the list via drag/drop.
> In the RC, I've selected "isDragSource" and "isDropTarget" for the
> listview.
...

I think you may have the wrong event names in your method (unless it is just
a transcription error).  Your events do not have colons on the end.  Look at
the published aspects of the View class for the event names.  The actual
drag/drop events have arguments.

> And in the onDrag method, I've created a new InternalDragDropObject,
> and used #format:data: to set the format and data for that object.
> My problem: my code doesn't seem to be initiating a DD session. I can
> pick up an object (and get the "Not Allowed" cursor), but that's it.
> If I set breakpoints in any of my onDragXXX or onDropXXX methods,
> execution never halts, so it seems like the wiring from
> #createSchematicWiring is ignored. I thought I had everything I needed
> to at least trigger the DD event but.....

If you can't get events to fire one thing I would check is to make sure your
onViewOpened method does a super send if you have one.  If you override this
method and forget to do a super send then createSchematicWiring will not be
called.  While you are at it you might check any standard MVP methods to
make sure you are super sending them if needed.

I had a heck of a time implementing drag and drop my self a few months ago.
I believe I had a mistaken assumption that one of the events (drag over
perhaps) was optional, when in fact it was required.  I tried to quickly add
drag and drop support by taking a shortcut and implementing as little code
as possible.  However I came to realize that drag and drop support can not
be added hastily (especially if you don't have experience with it in
Dolphin).  So I backed out and took a more thoughtful approach and got it
working.

> Any hints or clues as to what I may be doing wrong here?
> Sorry for the rambling post -- it's late, I'm tired, and I just can't
> seem to find an awful lot of info/documentation on DD with
> Dolphin.....

I could not find any documentation about drag and drop in Dolphin either.  I
just had to use the system tools as an example, and the comments as a
reference.

Chris


Reply | Threaded
Open this post in threaded view
|

Re: drag-drop help please....

keith
Thanks for the help, Chris!
You were exactly right....I was missing the colons on the selector
names.

I like Dolphin, but I think real improvement is needed in the area of
documentation. Having great resources like yourself, Ian and others is
fine, but for me, there's nothing quite like having a manual I can
flip through (or a .pdf file I can page through) to give me that "big
picture". Plus, good documentation is a *whole* lot lighter! (can't
imagine trying to stuff you or Ian in my back pocket :-)

Thanks again...

KeithB
"Christopher J. Demers" <[hidden email]> wrote in message news:<ap4kgh$rkkpa$[hidden email]>...

> ksbag <[hidden email]> wrote in message
> news:[hidden email]...
> > Hi all,
> > back again for some more help from this great group....
> > I'm trying to implement drag & drop for a listview on one of my shell
> > windows. Basically, I want to be able to move an element's position
> > higher or lower in the list via drag/drop.
> > In the RC, I've selected "isDragSource" and "isDropTarget" for the
> > listview.
> ...
>
> I think you may have the wrong event names in your method (unless it is just
> a transcription error).  Your events do not have colons on the end.  Look at
> the published aspects of the View class for the event names.  The actual
> drag/drop events have arguments.
>
> > And in the onDrag method, I've created a new InternalDragDropObject,
> > and used #format:data: to set the format and data for that object.
> > My problem: my code doesn't seem to be initiating a DD session. I can
> > pick up an object (and get the "Not Allowed" cursor), but that's it.
> > If I set breakpoints in any of my onDragXXX or onDropXXX methods,
> > execution never halts, so it seems like the wiring from
> > #createSchematicWiring is ignored. I thought I had everything I needed
> > to at least trigger the DD event but.....
>
> If you can't get events to fire one thing I would check is to make sure your
> onViewOpened method does a super send if you have one.  If you override this
> method and forget to do a super send then createSchematicWiring will not be
> called.  While you are at it you might check any standard MVP methods to
> make sure you are super sending them if needed.
>
> I had a heck of a time implementing drag and drop my self a few months ago.
> I believe I had a mistaken assumption that one of the events (drag over
> perhaps) was optional, when in fact it was required.  I tried to quickly add
> drag and drop support by taking a shortcut and implementing as little code
> as possible.  However I came to realize that drag and drop support can not
> be added hastily (especially if you don't have experience with it in
> Dolphin).  So I backed out and took a more thoughtful approach and got it
> working.
>
> > Any hints or clues as to what I may be doing wrong here?
> > Sorry for the rambling post -- it's late, I'm tired, and I just can't
> > seem to find an awful lot of info/documentation on DD with
> > Dolphin.....
>
> I could not find any documentation about drag and drop in Dolphin either.  I
> just had to use the system tools as an example, and the comments as a
> reference.
>
> Chris


Reply | Threaded
Open this post in threaded view
|

Re: drag-drop help please....

Ted Bracht-2
In reply to this post by Christopher J. Demers
>
> > Any hints or clues as to what I may be doing wrong here?
> > Sorry for the rambling post -- it's late, I'm tired, and I just can't
> > seem to find an awful lot of info/documentation on DD with
> > Dolphin.....
>
> I could not find any documentation about drag and drop in Dolphin either.  I
> just had to use the system tools as an example, and the comments as a
> reference.
>

I've got a little tutorial on my website to implement drag&drop

<http://homepage.ntlworld.com/ted.bracht/id22.htm>

Hope that helps,

Ted


Reply | Threaded
Open this post in threaded view
|

Re: drag-drop help please....

Sergei Gnezdov
In reply to this post by keith
> I like Dolphin, but I think real improvement is needed in the area of
> documentation. Having great resources like yourself, Ian and others is
> fine, but for me, there's nothing quite like having a manual I can
> flip through (or a .pdf file I can page through) to give me that "big
> picture".

I'd like to see improvements in the documentation too.