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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Listview Simplelist OLEdrag drop

Status
Not open for further replies.

Gotheallblacks

Programmer
Oct 16, 2003
60
NZ
I want to OLEdrag from a source onto the SimplelistListview and Take some action with the passed data

From the source object say a textbox
*OLEStartdrag
LPARAMETERS oDataObject, nEffect
* Clear out all data from the data object
oDataObject.ClearData
nEffect = 1
*-- Register the text (1) format
oDataObject.SetFormat( 1 ) && text

*OLESetdata

LPARAMETERS oDataObject, eFormat
DO CASE
CASE trans( eFormat ) == '1' && Text format
oDataObject.SetData( this.value, 1 )
ENDCASE

I have set the OLElist.OLEDropmode to 1 in the init method which shows allowed to drop

From the OLEDragover
LPARAMETERS oDataObject, nEffect, nButton, nShift, nXCoord, nYCoord, nState
IF nState == 0 && Drag Enter
DO CASE
CASE oDataObject.GetFormat( 1 )
* I can handle drops of text
* Tell OLEDragDrop that I know how to handle this
This.OLEDropHasData = 1
* Tell OLEDragDrop that I want to copy this
This.OLEDropEffects = 1
ENDCASE
ENDIF

And from the OLEDragdrop add a record to cursor and refreshlist

LPARAMETERS data, effect, button, shift, x, y

IF Data.getformat(1)
LOCAL lc
lc = Data.getdata(1)
SELECT test && (READWRITE CURSOR)
APPEND BLANK
replace test.item WITH 'new 1'
replace test.cname WITH lc
replace test.check WITH .t.
this.Parent.refreshlist()

ENDIF
My problem is ,this works with other objects like a Listbox and does not work with ListView, Listview is not recognising the drop.

 
What do you mean by "not recognising the drop"? Is your code in OLEDragDrop firing?

Tamar
 
Have you tried using the Event Tracker to see exactly which events are firing?

Tamar
 
Tamar Thanks for responding

Sample Event tracker with OLE to a text box

36542.364, picker.pglibraries.productpage.selected.OLEStartDrag(Object, 7)
36542.365, picker.pglibraries.productpage.selected.OLEDragOver(Object, 1, 1, 0, 63, 535, 0)
36542.366, picker.pglibraries.productpage.selected.OLEDragOver(Object, 1, 1, 0, 63, 535, 2)
36542.371, picker.pglibraries.productpage.selected.OLEDragOver(Object, 1, 1, 0, 68, 536, 2)
36543.080, picker.pglibraries.productpage.text1.OLEDragDrop(Object, 1, 1, 0, 205, 578)
36543.083, picker.pglibraries.productpage.selected.OLESetData(Object, 1)
36543.085, picker.pglibraries.productpage.selected.OLECompleteDrag(1)

Sample Event Tracker to The listview (Mikes simpleList)
36768.536, picker.pglibraries.productpage.selected.OLEStartDrag(Object, 7)
36768.537, picker.pglibraries.productpage.selected.OLEDragOver(Object, 1, 1, 0, 57, 540, 0)
36768.538, picker.pglibraries.productpage.selected.OLEDragOver(Object, 1, 1, 0, 57, 540, 2)
36768.544, picker.pglibraries.productpage.selected.OLEDragOver(Object, 1, 1, 0, 52, 532, 2)
36768.552, picker.pglibraries.productpage.selected.OLEDragOver(Object, 1, 1, 0, 47, 524, 2)
36768.560, picker.pglibraries.productpage.selected.OLEDragOver(Object, 1, 1, 0, 39, 513, 2)
36768.569, picker.pglibraries.productpage.selected.OLEDragOver(Object, 1, 1, 0, 30, 501, 2)
36768.577, picker.pglibraries.productpage.selected.OLEDragOver(Object, 0, 0, 0, -466, -82, 1)
36768.640, dataform1.OLEDragOver(Object, 1, 1, 0, 393, 237, 0)
36768.648, dataform1.OLEDragOver(Object, 1, 1, 0, 387, 226, 2)
36768.657, dataform1.OLEDragOver(Object, 1, 1, 0, 382, 216, 2)
36768.664, dataform1.OLEDragOver(Object, 1, 1, 0, 381, 207, 2)
36768.672, dataform1.OLEDragOver(Object, 1, 1, 0, 379, 200, 2)
36768.680, dataform1.OLEDragOver(Object, 1, 1, 0, 379, 193, 2)
36768.688, dataform1.OLEDragOver(Object, 1, 1, 0, 378, 188, 2)
36768.697, dataform1.OLEDragOver(Object, 1, 1, 0, 377, 183, 2)
36768.704, dataform1.OLEDragOver(Object, 1, 1, 0, 377, 181, 2)
36768.712, dataform1.OLEDragOver(Object, 1, 1, 0, 377, 176, 2)
36768.720, dataform1.OLEDragOver(Object, 1, 1, 0, 376, 171, 2)
36768.728, dataform1.OLEDragOver(Object, 1, 1, 0, 375, 165, 2)
36768.737, dataform1.OLEDragOver(Object, 1, 1, 0, 374, 159, 2)
36768.745, dataform1.OLEDragOver(Object, 0, 0, 0, -6, -91, 1)
36769.080, picker.pglibraries.productpage.selected.OLECompleteDrag(1)

I notice it doesn't OLESetdata ??
dataform1 is my test form with SimpleList- Listview

I'm stuck
 
Tamar

The OLEDragOver event doesn't fire
The OLESetdata event doesn't fire

Checked and rechecked OLEdropmode etc and can't see anything else Tried OLEListView by itself and no luck ??

Andrew

 
When the drop target isn't a VFP object, only the drag source's events fire, so you'll have to use those to do what you need.

Tamar
 
Tamar

I am not sure what you mean.

Would you provide an example please.


Andrew

 
Actually, thinking about this some more, the OLEDragDrop of the ActiveX control should be firing, assuming the control supports OLE drag and drop. Do you know whether it does?

Tamar
 
Tamar

'I have set the OLElist.OLEDropmode to 1 in the init method which shows allowed to drop' (above)

Not knowing that much about the OLEList I assume it does because it has this property. When set and the mouse drags over it shows mouse dropeffects but the The OLEDragDrop event doesn't fire,The OLESetdata event doesn't fire.

I cant find anything on google about OLEList dragdrop except this link


Which I took to beleive it could ??

Andrew
 
The link you posted is about the Microsoft ListView control. Your first message mentions the SimpleList ListView. That sounds like a different control.

As for having the OLDDropMode property, that's actually from the VFP container for the ActiveX control. I'm not sure that's informative.

Tamar
 
Tamar

You are correct - my mistake. I must have been looking too much.

I still could not find any info on a working example of OLEDragDrop to the Activex OLElist

Andrew
 
Tell us more about the control. Who makes it? Have you asked them whether it supports OLE drag and drop?

Tamar
 
Tamar

Sorry for confusing you and not explaining correctly

Its Mike Lewis's SimpleList which is a wrapper for MSComctlLib.ListViewCtrl.2

Andrew
 
Tamar

Its not the wrapper Its the MSComctlLib.ListViewCtrl.2
that I'm trying to drop on I have tried without the wrapper without success

Andrew
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top