Example: /Win/Drag and Drop/Folder Drag

Online Documentation   -   Statistics   -   FAQ   -   Plugin Parts (All, Dependencies)   -   Class hierarchy

New in Version 22.2 22.3 22.4 22.5 23.0 23.1 23.2 23.3 23.4 23.5 24.0 24.1

The list of the   topics,   classes,   interfaces,   controls,   modules,   global methods by category,   global methods by name,   screenshots,   licenses   and   examples.

Platforms to show: All Mac Windows Linux Cross-Platform

/Win/Drag and Drop/Folder Drag


Required plugins for this example: MBS Main Plugin, MBS Win Plugin

You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Win/Drag and Drop/Folder Drag

This example is the version from Sun, 17th Mar 2012.

Project "Folder Drag.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&Ablage"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
Class FolderDragWindow Inherits Window
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
EventHandler Function MouseDown(X As Integer, Y As Integer) As Boolean Return true End EventHandler
EventHandler Sub MouseDrag(X As Integer, Y As Integer) dropsource = new FolderDragSource dim file as FolderItem = CreateTestFolder dim files(-1) as FolderItem files.Append file dim data as new WinDataObjectMBS(files) dim effect as integer = 0 dim result as integer = dropsource.DoDragDrop(data, dropsource.DROPEFFECT_COPY, effect) End EventHandler
Function CreateTestFolder() As FolderItem dim folder as FolderItem = SpecialFolder.Temporary.Child("test") folder.CreateAsFolder dim logo as Picture = logoMBS(100) dim file as FolderItem = folder.Child("test.jpg") file.SaveAsJPEG logo Return folder End Function
Property dropsource As FolderDragSource
End Class
Class FolderDragSource Inherits WindowsDragSourceMBS
EventHandler Function GiveFeedback(Effect as integer) As integer Return DRAGDROP_S_USEDEFAULTCURSORS End EventHandler
EventHandler Function QueryContinueDrag(EscapePressed as boolean, KeyState as integer) As integer if EscapePressed then Return DRAGDROP_S_CANCEL end if if Bitwise.BitAnd(KeyState, MK_LBUTTON)=0 then return DRAGDROP_S_DROP end if Return S_OK End EventHandler
End Class
End Project

See also:

The items on this page are in the following plugins: MBS Win Plugin.


💬 Ask a question or report a problem