KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Adding a Icon to a Drag-able Object
PRODUCT: 4D | VERSION: 14.0 | PLATFORM: Mac & Win
Published On: April 21, 2014

4Dv14 allows a new feature that allows designers to provide more feedback from a User Interface when dragging objects. This feature allows a semi-transparent icon to appear when an object is being dragged. To select an image for the icon you must use the SET DRAG ICON() command.

For example:

SET DRAG ICON($image_p;$x_int;$y_int)

where:


  • $image is a picture variable

  • Movement of the image is in refference to the Mouse Pointer

  •    if $x_int and $y_int = 0:

       

  • $x_int is how much the image is offset from the left most side of the picture (Positive moves the image left)

  •    if $x_int = width of image:

       

  • $y_int is how much the image is offset from the top most side of the picture (Positive moves the image up)

  •    if $y_int = height of image:

       

  • $x_int and $y_int are optional, leaving them out, centers the image at the pointer.

  •    if SET DRAG ICON($image_p) was called:

       


Using this new feature when designing a User Interface will provide more feedback to a user. It lets them know that the item they are attempting to drag and drop is successfully being dragged when they visibly see an icon appear during the attempt.

Note that the object must have the On Begin Drag Over event active and that the command must be called in the object's method before or during the On Begin Drag Over event. Once draggin has begun the image cannot change until dropped.