Re: Win32Lib; Events; Drag'n Drop
- Posted by CChris Jul 03, 2008
- 716 views
According to the Win32Lib manual, it states that the drag'n drop event can be trigged when dragging elements into certain controls.
However, I'm only successful in using the form as the target control/window.
In my program, the handle for the form is "fmMAF", and I also have a ListView which handle is "lvMAFFiles". If I use lvMAFFiles in the below statement, no event is triggered. However, if I change it to fmMAF it is triggered.
setHandler(fmMAF, w32HDragAndDrop, routine_id("vMAF_DragAndDropFiles_TV"))
Is it the documentation that is wrong, or is it the code (Am I using it wrong?)?
Kenneth / ZNorQ
Yes, I can confirm that, eg this example using the example from the latest docs:
-- code generated by Win32Lib IDE v1.0.2 Build Oct-09-2007 constant TheProgramType="exw" include Win32Lib.ew without warning -------------------------------------------------------------------------------- -- Window fmMAF constant fmMAF = createEx( Window, "Window1", 0, Default, Default, 400, 333, 0, 0 ) constant lvMAFFiles = createEx( ListView, {"ListView2",""}, fmMAF, 88, 56, 200, 200, w32or_all({LVS_ICON,LVS_SHOWSELALWAYS,LVS_AUTOARRANGE}), 0 ) constant actionButton = createEx( PushButton, "Do Nothing", fmMAF, 144, 272, 88, 24, 0, 0 ) --------------------------------------------------------- -------------------------------------------------------------------------------- with trace -------------------------------------------------------------------------------- procedure lvMAFFiles_onDragAndDrop (integer self, integer event, sequence params)--params is ( int id, sequence FileName ) trace(1) if params[1] = 0 then if length(params[2]) = 1 then -- Opening call, the file count. setEnable(actionButton, w32False) eraseItems(self) --vFileCount = params[2] elsif length(params[2]) = 0 then -- Final call. setEnable(actionButton, w32True) else -- add the file name to the list addItem(self, params[2] ) end if end if end procedure setHandler( lvMAFFiles, w32HDragAndDrop, routine_id("lvMAFFiles_onDragAndDrop")) --------------------------------------------------------- WinMain( fmMAF,Normal )
You'll never see the trace window :)
Gary
Ok. So either it is a bug in the Win32Lib code, or the documentation is wrong.
Kenneth / ZNorQ
I thought I had already replied, but something must have gone wrong.
The docs are half wrong:
- Normally, dragging files from an Explorer-like application will work
- The listview gets the notfication when something gets dragged - see the fDoLVN_BEGINDRAG() function or similar. But the function currently just ack's the drag, so nothing happens.
So the docs are half wrong and the handling is incomplete.
I have an undistributed todo.txt which lists, among other things, "details" like this for ListView conrols, which haven't been taken care of. I'll try to get some working in 70.5, but this is not for tomorrow.
CChris