[Gambas-user] File Chooser Drag and Drop

Stephen Bungay SoftwareDevelopment at smartsonsite.com
Sun Jul 17 16:01:54 CEST 2022


I gave up on the file chooser, sorry, it's just not up to the task. Then 
again GAMBAS may no longer be up to the task as even the TextArea is not 
working according to the rules of causality. For example, using the file 
manager a text file can be dropped on the text area. The file name gets 
pasted into the text area, the "change" event fires, but the "drop" 
event does NOT fire?! How does THAT work? Moreover why is it allowed to 
work? When something is dropped on a control and that drop effects a 
change then the "drop" event must fire before the "change" event.

Things appear to have strayed somewhat from first principals.

On 2022-07-17 06:32, Bruce Steers wrote:
> On Sun, 17 Jul 2022 at 03:28, sbungay <sbungay at smartsonsite.com> wrote:
>
>                      Using the file chooser I want to drag one of the
>                     files from it
>                     (represented by its icon) to a text area and on
>                     dropping it have the
>                     text area load the file. Can't seem to get this to
>                     work, anyone have an
>                     example project I can examine?
>
>
> There seems to be another issue.
> For your specific task of writing the file contents into the textarea.
> It seems we cannot override/intercept or turn off the way a textarea 
> pastes the file name on drop.
> I tried using text/uri-list as format, still just the filename is 
> pasted not the contents.
>
> I even tried setting TextArea1.Drop = False , still it pastes filename 
> in!?
> You can make a Button (or something) with Drop enabled, then drag 
> filechooser files there and the load file into TextArea but using 
> TextArea_Drop() does nothing at all. still only default behaviour.
>
> *Public Sub Button1_Drop()
> Dim s As String = Drag.Data
> If Not s Then s = Drag.Paste("text/uri-list")
>  If Exist(s) Then TextArea1.Text = File.Load(s)
> End*
>
> TextArea1_Drop() event does not even trigger.
> BruceS
>
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----



More information about the User mailing list