Home Page

Previous Menu

Contact Us

Drag & Drop Editing

Code Supplied by John Morter

Download the code

John Morter of Flat Chat Solutions (Australia) has sent me a template which is a nice variation on TrashFlash. It allows drag and drop changes and deletes by using the standard browse buttons as "drop zones".   Click here to download the template.

The template will work with C4 and C5 ABC

Usage:

  Register normally
  Add the template to the browse.
  Fill in the prompts.


#TEMPLATE (jmDDEdit, 'Drag & Drop editing - Flat Chat Solutions'),FAMILY('ABC')
#!
#! From Flat Chat Solutions, Australia
#! Version 1.0 October, 1999
#!
#! This Template creates "Drag & Drop sensitive" regions around the
#! Change & Delete buttons of a Browse - upon which Browse records can be
#! dropped - invoking the logic behind the target button.
#!
#! Thanks to Sterling Data Services for making the idea for this template
#! available on their web-site at http://www.sterlingdata.com
#!
#! To use in your own apps:
#! 1) Register jmDDEdit.TPL
#! 2) From Procedure <BrowseName> Properties, click the Extensions button
#! 3) Press the Insert button and select the jmDDEdit extension for insertion
#! - confirm the controls to be included in Drag & Drop editing
#! - that's all there is to it!
#!
#!
#EXTENSION(jmDDedit,'Drag & Drop Change/Delete'), DESCRIPTION('Drag and Drop Change/Delete'), WINDOW
#DISPLAY ('')
#DISPLAY ('jmDDEdit - From Flat Chat Solutions, Australia')
#DISPLAY ('')
#DISPLAY (' Thanks to Sterling Data Services for the idea')
#DISPLAY (' - see www.sterlingdata.com')
#DISPLAY (' and to Topspeed Turnpike for pointing me there')
#DISPLAY (' - see www.netins.net/showcase/tomruby/clarion/')
#DISPLAY ('')
#BOXED('Edit Drag Source:')
#DISPLAY ('')
#PROMPT('Browse:',FROM(%Control,%ControlType = 'LIST')),%jmDDEditBrowse,DEFAULT('?Browse:2'),REQ
#DISPLAY ('')
#DISPLAY ('Note: The Browse Drag ID will be set to ''jmDDEditDID''')
#ENDBOXED
#DISPLAY ('')
#BOXED('Edit Drop Targets:')
#DISPLAY ('')
#PROMPT('Browse Change Button:',FROM(%Control,%ControlType = 'BUTTON')),%jmDDEditChgButton,DEFAULT('?Change:2'),REQ
#PROMPT('Browse Delete Button:',FROM(%Control,%ControlType = 'BUTTON')),%jmDDEditDelButton,DEFAULT('?Delete:2'),REQ
#ENDBOXED

#AT (%WindowManagerMethodCodeSection, 'Init','(),BYTE'),PRIORITY(8010)
%jmDDEditBrowse{PROP:DRAGID} = 'jmDDEditDID' ! Set Source DragID
%jmDDEditChgButton{PROP:DROPID} = 'jmDDEditDID' ! Set Change Button DropID
%jmDDEditDelButton{PROP:DROPID} = 'jmDDEditDID' ! Set Delete Button DropID
#ENDAT

#AT (%WindowManagerMethodCodeSection, 'TakeFieldEvent','(),BYTE'), PRIORITY(3060)
OF %jmDDEditChgButton
IF EVENT()=EVENT:Drop
POST(EVENT:Accepted,%jmDDEditChgButton) ! Drag/Drop Change
.
OF %jmDDeditDelButton
IF EVENT()=EVENT:Drop
POST(EVENT:Accepted,%jmDDEditDelButton) ! Drag/Drop Delete
.
#ENDAT


See Part II of Template Programming for Beginners for an understanding of how this template works.

December 1999: Jim Dennison has also kindly sent in a modified TrashFlash template - this one plays sounds effects!  And also the drag ID is auto set and the X & Y position added to the icon file for one step control placement.  Click Here to download Jim's template


Home Page

Previous Menu

Contact Us