1. Drag and Drop - a question
- Posted by AndyDrummond Apr 29, 2011
- 1505 views
Having demonstrated drag and drop before now, and used it as well, I find that, in the program I am working on now, when I drag an icon over the program window, it reverts to a "No go" icon which implies d'n'd is disabled. So how do I enable it? What do I need to enable d'n'd in a Euphoria program? Presumably it is something to do with createEx() in the beginning, but - what? Any ideas? I used the window styles visual editor to dispose of the title bar, and I suspect that may be something to do with it. But I also have found (at one time) that when the window was 155 pixels wide it worked, under that and it failed. But that was only a transient effect so probably something else was changing.
I'm using Eu 3.1, Judith's IDE, the latest Win32Lib and Windows7 - with UAC turned to minimum and as an administrator.
I'm trying to write a program to replace the side toolbar that I could use in XP so easily - and which Microsoft have so annoyingly decided we don't need or can't have. I can find no half-decent replacement - so, IDE, here I come again. This is the first new program I have begun since getting W7.
Andy
2. Re: Drag and Drop - a question
- Posted by ne1uno Apr 29, 2011
- 1436 views
Having demonstrated drag and drop before now, and used it as well, I find that, in the program I am working on now, when I drag an icon over the program window, it reverts to a "No go" icon which implies d'n'd is disabled. So how do I enable it? What do I need to enable d'n'd in a Euphoria program?
maybe DragAcceptFiles(hwnd, TRUE), you also need code to handle the drop but that will be something to search on to find some code.
3. Re: Drag and Drop - a question
- Posted by AndyDrummond Apr 29, 2011
- 1410 views
maybe DragAcceptFiles(hwnd, TRUE), you also need code to handle the drop but that will be something to search on to find some code.
Yes, sounds perfect ... but that doesn't seem to be in Win32Lib(). Do you know where I might find it?
Thanks...
4. Re: Drag and Drop - a question
- Posted by dcole May 02, 2011
- 1407 views
Hello Andy,
Launch Pad (v4.03) is in the Archives.
It has a Drop and Drag feature that work fine in both XP and Windows 7.
However, it is written in WinClass. You have to download WinClass.ew also in the archives.
Hope this helps.
Don Cole
5. Re: Drag and Drop - a question
- Posted by AndyDrummond May 02, 2011
- 1360 views
Thanks, Don, I'll give it a go later in the week - I'm out of the office a few days. But it does sound a bit over the top. I've had drag and drop working fine before; now I'm finding sometimes it is OK and other times, as I said, I get the "Illegal" icon coming up. I just don't understand why I get the variation. But I'll look at WinClass and see if that gives me any ideas....
andy
What is an elephant, but a mouse running under Windows?
6. Re: Drag and Drop - a question
- Posted by andi49 May 03, 2011
- 1312 views
Hallo
This could be a common problem (feature) with Win7. You can test it. It should only appear if you run your program as Administrator.
In Win7 lower privileged Processes are not allowd to Drag Files to higher privileged Processes. In your case I think you start your program as Admin. Drag and Drop should work from other programs you started but not from lower privilegd ones (say Explorer).
This is bcause some Messages are filterd, with this UAC thing on, and you must explizit allow this messages to reach your high privilegd App.
The following is from MSDN:
ChangeWindowMessageFilter (WM_DROPFILES, MSGFLT_ADD) ChangeWindowMessageFilter (WM_COPYDATA, MSGFLT_ADD)
Wrapping this ApiCalls should not be this hard
Hope this helps Andreas
7. Re: Drag and Drop - a question
- Posted by AndyDrummond May 03, 2011
- 1275 views
Thanks, andi49, but I don't think that's it. Yes, I am administrator, and I have UAC set at minimum (I like to be able to write to my computer drives as I want). But I have had a program which would accept drag and drop files until I made its window width less than 155; then it rejected them. I'm really at a loss. Maybe I should bind the same program (a very trivial one) with two widths, so that one works and one doesn't. Then I can post them and see what people find....
I'll dig into the MSDN API as you suggest - I have tried the MSDN route already with no joy, but your suggestion might produce something more useful.
When I get to the office ...
8. Re: Drag and Drop - a question
- Posted by AndyDrummond May 03, 2011
- 1266 views
OK, I have two programs - not as described before, but one accepts DnD, one doesn't. Does anyone have a nice simple answer as to what the last parameter in createEx() should be to explain the difference? I looked at Windows API but couldn't see the answer - maybe I am just slow. No comments, please.
include Win32Lib.ew without warning constant W1 = createEx( Window, "", 0, 0, 0, 188, 780, {WS_THICKFRAME, WS_SYSMENU, WS_MINIMIZEBOX, WS_MAXIMIZEBOX}, {} ) constant W2 = createEx( Window, "", 0, 0, 0, 188, 780, {WS_THICKFRAME, WS_SYSMENU, WS_MINIMIZEBOX, WS_MAXIMIZEBOX}, 0 ) -- Run this using W1 and try dragging a file onto the window...you can't -- Try it again using W2 and try again. You can drag onto the window -- So what is the difference between using a last parameter 0 or a null sequence? -- I can't see the information in Win32Lib docs... WinMain( W1,Normal )
It does allow me to progress, though, but I ought to know the reason...
9. Re: Drag and Drop - a question
- Posted by DerekParnell (admin) May 03, 2011
- 1236 views
Does anyone have a nice simple answer as to what the last parameter in createEx() should be to explain the difference?
Your example is an excellent way to help people diagnose an issue. Thanks for that.
The issue is that when the flags parameter is a sequence, such as {}, then win32lib builds a Windows API Flag using only the values inside the sequence. In your case, as there are no values in the sequence, the API flag is set to zero - meaning that there are NO extended flags used.
But when the parameter to createEx() is an atom, it is appended to the the default extended flags, which happens to be WS_EX_ACCEPTFILES for creating Windows.
So, if you define the new window using {WS_EX_ACCEPTFILES} you should get the same result as using just 0.
10. Re: Drag and Drop - a question
- Posted by ArthurCrump May 03, 2011
- 1266 views
...Various omissions
constant W1 = createEx( Window, "", 0, 0, 0, 188, 780, {...}, {} ) constant W2 = createEx( Window, "", 0, 0, 0, 188, 780, {...}, 0 )
It does allow me to progress, though, but I ought to know the reason...
In the createEx function, if the exFlags parameter is an atom, as in W2, it is combined with a default flag, which happens to be WS_EX_ACCEPTFILES.
However, if the exFlags parameter is a sequence, as in W1, any values in the sequence are intended to replace the default.
So, W1 loses the WS_EX_ACCEPTFILES exFlag.
11. Re: Drag and Drop - a question
- Posted by AndyDrummond May 04, 2011
- 1215 views
The issue is that when the flags parameter is a sequence, such as {}, then win32lib builds a Windows API Flag using only the values inside the sequence. In your case, as there are no values in the sequence, the API flag is set to zero - meaning that there are NO extended flags used.
But when the parameter to createEx() is an atom, it is appended to the the default extended flags, which happens to be WS_EX_ACCEPTFILES for creating Windows.
So, if you define the new window using {WS_EX_ACCEPTFILES} you should get the same result as using just 0.
Derek, and Arthur, you have put your knowledgeable fingers on it! That accounts for the problem I was having, and now (in IDE) I can simply add the WS_EX_ACCEPTFILES to the main window flags. And Bang! That works perfectly!
It is SO nice to crack these problems. When I get a funny I don't understand, I need to get to the bottom of it or I just go on guessing for ever. Ignorance may be bliss but knowledge is a darn sight more blissful!
Thank you all, topic closed.
Andy
12. Re: Drag and Drop - a question
- Posted by Vinoba May 04, 2011
- 1195 views
"However, if the exFlags parameter is a sequence, as in W1, any values in the sequence are intended to replace the default. "
A null value or an empty sequence is not the same as "0"
Below I have used APL to explain the difference. I have used - - - for comments
0
- - - (nothing shows up on the screen)
atomB ← 0 - - - atomB is assigned an Atom with value 0
⍴atomB - - - size of atomB ( APL way of doing length(atomB) )
- - - is nothing (nothing shows up on the screen)
atomB - - - confirming value in atomB is 0 (APL way of doing ?atomB)
0