Skip to content

Instantly share code, notes, and snippets.

@MarkGoldberg
Created May 20, 2016 10:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MarkGoldberg/0d934365687a0cf35a57a7b55693733f to your computer and use it in GitHub Desktop.
Save MarkGoldberg/0d934365687a0cf35a57a7b55693733f to your computer and use it in GitHub Desktop.
Clarion Drag and Drop Example
TestDragAndDrop PROGRAM
MAP
Frame
DragFrom
DragTo
END
! Note: if you don't have debuger.inc then just rem all lines using DBG -- it's just for sending event info to OutputDebugString
! which you can view with DebugView++ or DbgView
INCLUDE('debuger.inc'),ONCE
DBG Debuger
CODE
DBG.mg_init('TestDND')
Frame
Frame PROCEDURE
AppFrame APPLICATION('Application'),AT(,,505,318),CENTER,MASK,SYSTEM,MAX,ICON('WAFRAME.ICO'),STATUS(-1,80,120,45),FONT('Microsoft Sans Serif',8,,FONT:regular),RESIZE
MENUBAR,USE(?Menubar)
ITEM('DragFrom'),USE(?DragFrom)
ITEM('DragTo'),USE(?DragTo)
MENU('&File'),USE(?FileMenu)
ITEM('&Print Setup ...'),USE(?PrintSetup),MSG('Setup printer'),STD(STD:PrintSetup)
ITEM(''),SEPARATOR,USE(?SEPARATOR1)
ITEM('E&xit'),USE(?Exit),MSG('Exit this application'),STD(STD:Close)
END
MENU('&Edit'),USE(?EditMenu)
ITEM('Cu&t'),USE(?Cut),MSG('Remove item to Windows Clipboard'),STD(STD:Cut)
ITEM('&Copy'),USE(?Copy),MSG('Copy item to Windows Clipboard'),STD(STD:Copy)
ITEM('&Paste'),USE(?Paste),MSG('Paste contents of Windows Clipboard'),STD(STD:Paste)
END
MENU('&Window'),USE(?WindowMenu),STD(STD:WindowList)
ITEM('T&ile'),USE(?Tile),MSG('Make all open windows visible'),STD(STD:TileWindow)
ITEM('&Cascade'),USE(?Cascade),MSG('Stack all open windows'),STD(STD:CascadeWindow)
ITEM('&Arrange Icons'),USE(?Arrange),MSG('Align all window icons'),STD(STD:ArrangeIcons)
END
MENU('&Help'),USE(?HelpMenu)
ITEM('&Contents'),USE(?Helpindex),MSG('View the contents of the help file'),STD(STD:HelpIndex)
ITEM('&Search for Help On...'),USE(?HelpSearch),MSG('Search for help on a subject'),STD(STD:HelpSearch)
ITEM('&How to Use Help'),USE(?HelpOnHelp),MSG('How to use Windows Help'),STD(STD:HelpOnHelp)
END
END
END
CODE
OPEN(AppFrame)
POST(EVENT:Accepted, ?DragFrom)
POST(EVENT:Accepted, ?DragTo )
ACCEPT
DBG.PrintEvent('Frame')
CASE ACCEPTED()
OF ?DragFrom; START(DragFrom)
OF ?DragTo ; START(DragTo )
END
END
DragFrom PROCEDURE
Window WINDOW('DragFrom'),AT(1,1,100, 100),MDI,GRAY,SYSTEM,FONT('Microsoft Sans Serif',8,,FONT:regular),RESIZE
REGION,AT(1,1,153,86),USE(?PANEL1),DRAGID('XYZ')
BUTTON('&OK'),AT(66,54,35,14),USE(?OkButton),DEFAULT
BUTTON('&Cancel'),AT(107,54,36,14),USE(?CancelButton),STD(STD:Close)
END
CODE
OPEN(Window)
ACCEPT
DBG.PrintEvent('DragFrom')
CASE EVENT()
OF EVENT:Drag ; SETDROPID('Hi it is ' & FORMAT( CLOCK(), @T4) )
END
END
DragTo PROCEDURE
Window WINDOW('DragTo'),AT(110,,161,100),MDI,GRAY,SYSTEM,FONT('Microsoft Sans Serif',8,,FONT:regular),RESIZE
BUTTON('Drop On Me'),AT(33,29,88,37),USE(?OkButton),DEFAULT,DROPID('XYZ')
END
CODE
OPEN(Window)
0{PROP:XPOS} = 200
ACCEPT
DBG.PrintEvent('DragTo')
CASE EVENT()
OF EVENT:Drop ; MESSAGE('DropID()['& DropID() &']')
END
END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment