Page 1 of 2

Drag/Drop Text Not working

Posted: Sat May 10, 2014 6:56 am
by Jumbuck
Can some member tell me why the following code is not working now.
The exact same code in another program written some time ago
compiled quite O.K under PB5.11
Here is my entries in the window creation section.
;****************************************************************
EnableGadgetDrop(#Gadget_GSolutionBox1,#PB_Drop_Text,#PB_Drag_Copy)
EnableGadgetDrop(#Gadget_GSolutionBox2,#PB_Drop_Text,#PB_Drag_Copy)
EnableGadgetDrop(#Gadget_GSolutionBox3,#PB_Drop_Text,#PB_Drag_Copy)
EnableGadgetDrop(#Gadget_GSolutionBox4,#PB_Drop_Text,#PB_Drag_Copy)
EnableGadgetDrop(#Gadget_GSolutionBox5,#PB_Drop_Text,#PB_Drag_Copy)
EnableGadgetDrop(#Gadget_GSolutionBox6,#PB_Drop_Text,#PB_Drag_Copy)
EnableGadgetDrop(#Gadget_GSolutionBox7,#PB_Drop_Text,#PB_Drag_Copy)
EnableGadgetDrop(#Gadget_GSolutionBox8,#PB_Drop_Text,#PB_Drag_Copy)
EnableGadgetDrop(#Gadget_GSolutionBox9,#PB_Drop_Text,#PB_Drag_Copy)
EnableGadgetDrop(#Gadget_GSolutionBox10,#PB_Drop_Text,#PB_Drag_Copy)
EnableGadgetDrop(#Gadget_GSolutionBox11,#PB_Drop_Text,#PB_Drag_Copy)
;This section is for Drag & Drop operation into StringGadgets
;****************************************************************
Here is the code which will not work now in my .pb file.
;===========================================
; WINDOW DRAG & DROP TEXT EVENT SECTION
;===========================================
;===========================================
;Grid WordGame Event
;===========================================
;******************************************************
;NOTE!!! #PB_Event_GadgetDrop has to appear BEFORE
;section to get Dragged Text
;******************************************************
;-----------------------------------------------------------------
;This section drops dragged "Text" into Grid Game StringGadget
;-----------------------------------------------------------------
Case #PB_Event_GadgetDrop
Select GadgetID
Case #Gadget_GSolutionBox1 To #Gadget_GSolutionBox11
SetGadgetText(GadgetID, EventDropText())
EndSelect

Case #PB_Event_Gadget
;--------------------------------------------------------------------------
;This section gets TextGadget "Text" to be Dragged
;--------------------------------------------------------------------------
Select GadgetID
Case #TextGadget_GBox1 To #TextGadget_GBox77
Item = GetGadgetText(GadgetID) : Result = DragText(Item)
EndSelect
Here is the start section of my .pb file.
Repeat
EventID = WaitWindowEvent()
MenuID = EventMenu()
GadgetID = EventGadget()
WindowID = EventWindow()
Select EventID
The complete program code is far too large to show here.
(Using Single Handler code).
Windows7 Professional 32Bit PB Version 5.11

Re: Drag/Drop Text Not working

Posted: Sat May 10, 2014 1:27 pm
by Zach
Forum tip:

Use code tags

Code: Select all

[code]
Your code here
[/code]

Re: Drag/Drop Text Not working

Posted: Sat May 10, 2014 1:52 pm
by Jumbuck
Zach
Did not think necessary for this post.
Not working code only snippets here and there from program
which is far too large to post here.
Thanks for looking anyway.

Re: Drag/Drop Text Not working

Posted: Sat May 10, 2014 9:22 pm
by Kuron
You mentioned old code that worked when compiled, but does that old compiled code still work now on the system you are testing on? That would help narrow down the problem.

You might want to search as I posted some fixes for similar issues that may help in your case, or it may not. If the fixes I posted are the issue. The short of it is, Drag and Drop really shouldn't be used anymore due to the protections in Windows. For it to function properly for many of your end users, they will have to override security settings on their OS which will leave their OS open and vulnerable just to get your program to run properly.

Re: Drag/Drop Text Not working

Posted: Sun May 11, 2014 12:10 am
by Jumbuck
Kuron
Thanks for reply.
Old code was written and working early 1913 using PB 4.61
Trying to use the identical code as posted in current project.
Yes the old code program will compile and run O.K under PB Version 5.11
Can you tell me where and when you posted the issues you refer to.
Maybe because of the differences in PB Versions used I need some
updated code to achieve Drag/Drop in my present project.
Can any member show me an example to Drag text from a TextGadget
and Drop the text into a StringGadget using PB 5.11. Thanks

Re: Drag/Drop Text Not working

Posted: Sun May 11, 2014 12:27 am
by IdeasVacuum
Old code was written and working early 1913
Things have changed a bit since then........ :)

Re: Drag/Drop Text Not working

Posted: Sun May 11, 2014 4:23 am
by Kuron
Old code was written and working early 1913 using PB 4.61
Windows hasn't improved for the better since then.
Yes the old code program will compile and run O.K under PB Version 5.11
I didn't ask if it would compile under PB, I asked if the old EXE would run on the same OS you are having issues with. However, if the old code will compile and run okay under 5.11, it is likely user error which nobody can help you with when only a snippet of code has been shown. Somewhere you have something knackered in your new program. Carefully compare your old code with your new code.

I would also suggest using the latest version of PB so you have any relevant bug fixes.

Re: Drag/Drop Text Not working

Posted: Sun May 11, 2014 11:54 pm
by wombats
Kuron wrote:The short of it is, Drag and Drop really shouldn't be used anymore due to the protections in Windows. For it to function properly for many of your end users, they will have to override security settings on their OS which will leave their OS open and vulnerable just to get your program to run properly.
What? Can you explain this, please? Are you talking about the whole of PB's Drag and Drop library? I haven't used Windows extensively in a while, but a project I'm working on relies quite heavily on it. I tested it on a fresh install of Windows 7 last night without any need to override security settings.

Re: Drag/Drop Text Not working

Posted: Mon May 12, 2014 6:39 am
by Kuron
What? Can you explain this, please?
I have explained it in the past and provided relative links in an old post here. I would have to search for it the same as you would, but it should be easy for you to find.

Are you talking about the whole of PB's Drag and Drop library?
I am talking about anything written for Windows that uses drag and drop functionality. What language it is written in doesn't matter as the issue is in the operating system.

I tested it on a fresh install of Windows 7 last night without any need to override security settings
Unless you are writing software solely for yourself, you are not your own end user. So unless all of your end users will be using your system, "It works for me" has no relevancy. The issue is one that is known and documented. It is hit or miss and does not exist for everybody. It was enough of a nuisance for me in an app that was in use by thousands of people, that I disabled drag and drop. I have also seen it affect others in the various programming communities and require the disabling of security features for it to work.

I haven't used Windows extensively in a while
Me either and I don't miss it.

Re: Drag/Drop Text Not working

Posted: Mon May 12, 2014 8:02 am
by Fangbeast
wombats wrote:
Kuron wrote:The short of it is, Drag and Drop really shouldn't be used anymore due to the protections in Windows. For it to function properly for many of your end users, they will have to override security settings on their OS which will leave their OS open and vulnerable just to get your program to run properly.
Wombats, Kuron is right. When I graduated up to windows 8, drag and drop fell over 90% of the time on the same code that worked 100% on Windows 7 and earlier.

Then I visited various Windows 8 support forums and there were many horrible ways of altering critical secure functions just to get drag and drop to work that it wasn't viable. None of which worked here I might add.

It is just not consistently working enough to be able to get a program out to customers and hope it works on their computers without having to get into huge support issues. And I don't think Microsoft are going to fix this anytime soon.

Re: Drag/Drop Text Not working

Posted: Mon May 12, 2014 8:51 am
by Kuron
It is not something for MS to fix. It is by design and I actually support their reasons for doing it.

Re: Drag/Drop Text Not working

Posted: Mon May 12, 2014 9:04 am
by Fangbeast
Kuron wrote:It is not something for MS to fix. It is by design and I actually support their reasons for doing it.
That is your opinion. Drag and drop has worked on every version of their O/S ever released and there is no reason that it should not work properly now. The details or the reason behind it are unimportant, they gave us a feature that we used for a decade at least and we pushed it onto our customers, got used to the convenience in thousands of applications and now we can't have it and our customers have to eat it and like it??

The absurdity of this situation is beyond laughter. It should and could be fixed by any competent programmer at ms given the billions of dollars that they have to spend, especially when they quote security as an issue. But, this is ms we are talking about, kill features they cannot get to work right.

There are so many ways that this could be gotten working again.

Now, I don't want to talk any more. I have to take my heart pills, get my cane, resolder my knee replacements, relube my hips, suture my blown arteries, put on my magnifying lens glasses, eat my 3 tonnes of fibre, go to the loo every 5 minutes.... I am too busy to code!

What day is it again?

Re: Drag/Drop Text Not working

Posted: Mon May 12, 2014 9:33 am
by wombats
Kuron wrote:
What? Can you explain this, please?
I have explained it in the past and provided relative links in an old post here. I would have to search for it the same as you would, but it should be easy for you to find.
I had a read through this thread, but it's not clear to me (perhaps because it's 4:30AM), but is drag and drop between applications the only thing affected, or also drag and drop within an application? For example, if in a PureBasic application you dragged from a TreeGadget to a ListIconGadget, would that be affected?
Kuron wrote:
wombats wrote:I tested it on a fresh install of Windows 7 last night without any need to override security settings
Unless you are writing software solely for yourself, you are not your own end user. So unless all of your end users will be using your system, "It works for me" has no relevancy. The issue is one that is known and documented. It is hit or miss and does not exist for everybody. It was enough of a nuisance for me in an app that was in use by thousands of people, that I disabled drag and drop. I have also seen it affect others in the various programming communities and require the disabling of security features for it to work.
What I meant by this is by testing it on a fresh install of Windows 7, I would not have touched any of the security settings that could affect the drag and drop functions. PureBasic was literally the first thing I downloaded and installed after Windows was done installing its updates. I was ignorant to such an issue with drag and drop on Windows 8. The only times I've used it were at college and I did not enjoy the experience.

Re: Drag/Drop Text Not working

Posted: Mon May 12, 2014 10:16 am
by Kuron
Fangbeast wrote:That is your opinion.
It is not my opinion, it is by design. For the record, I fully support anything MS does to shoot themselves in the foot and piss off their users. :mrgreen:

Fangbeast wrote:now we can't have it and our customers have to eat it and like it??
You do realize you are talking about Windows and Microsoft, right?

Re: Drag/Drop Text Not working

Posted: Mon May 12, 2014 2:00 pm
by PB
> The absurdity of this situation is beyond laughter

If I understand correctly, then I agree. Is this discussion saying that drag/drop
no longer exists on Windows 8? So we can't even drag an image onto a paint
program to open it? I seriously hope I'm misunderstanding this.