Drag 'n' Drow works not with QT - PB 5.73

Linux specific forum
User avatar
Saki
Addict
Addict
Posts: 830
Joined: Sun Apr 05, 2020 11:28 am
Location: Pandora

Drag 'n' Drow works not with QT - PB 5.73

Post by Saki »

I just noticed that Drag 'n' Drop does not work with QT.

I think it has simply been overlooked to implement it.

Code: Select all

Define window_ID=OpenWindow(#PB_Any, 0, 0, 350, 80, "",
                            #PB_Window_ScreenCentered|#PB_Window_SystemMenu)
Define button_ID=ButtonGadget(#PB_Any, 10, 10, WindowWidth(window_ID)-20, 60, "How")
EnableGadgetDrop(button_ID, #PB_Drop_Files, #PB_Drag_Link)

Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
地球上の平和
Fred
Administrator
Administrator
Posts: 18220
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Drag 'n' Drow works not with QT - PB 5.73

Post by Fred »

It actually works, but I didn't find a way to create a drag in 'Link' mode using Nautilus. For 'Copy' mode, just drag it,
for 'Move' mode drag it with 'Shift' key pushed. Can someone give it a try ?

Code: Select all

  ; Drag a file to one of the gadets and you will receive the file path
  ;
  If OpenWindow(0, 0, 0, 500, 200, "Drop File Here", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  
    ButtonGadget(0, 10, 10, 500 - 20, 30, "")
    EditorGadget(1, 10, 50, 500 - 20, 140)
    
    EnableGadgetDrop(0, #PB_Drop_Files, #PB_Drag_Link) ; Link mode
    EnableGadgetDrop(1, #PB_Drop_Files, #PB_Drag_Copy)
  
    Repeat
        Select WaitWindowEvent()
            Case #PB_Event_GadgetDrop
                Select EventGadget()
                    Case 0 ; gadgets that received a file/folder drag and drop event
                        If Not FindString(EventDropFiles(), Chr(10))
                            SetGadgetText(0, EventDropFiles())
                        EndIf
                    Case 1
                        SetGadgetText(1, EventDropFiles())
                EndSelect
            Case #PB_Event_CloseWindow
                CloseWindow(0)
                End
        EndSelect
    ForEver
  EndIf
Post Reply