Drag widgets from Tools -- solve issues?

This forum is a working group for community contributors to the LiveCode IDE included in the main LiveCode distribution.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Locked
[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Drag widgets from Tools -- solve issues?

Post by [-hh] » Wed Sep 20, 2017 6:25 pm

The current dragHandler for widgets from the Tools palette in
Tools/Toolset/palettes/tools/revtools.livecodescript has some issues.

For example:
If a widget does "set the backColor of this card to black" in OnCreate (using "post"), then the backColor of the tools palette is set to black.

My proposal is to use (if available) the SVGIcon or icon@extra-high.png or a default SVG [optionally at preferredSize] as "dragImage".

This could also resolve problems that I have with some of my widgets: After dragging the widget from the Tools palette the latter is hidden (or probably: put off-screen).

The following part on the way to that goal works:
Inserted at line 605 Tools/Toolset/palettes/tools/revtools.livecodescript line 605

Code: Select all

# Create a control and Generate a drag image
if tObjectTypeID begins with "community.livecode.hermann." then
  put revIDEExtensionProperty(tObjectTypeID, "icon") into fImg
  if fImg is empty then put revIDEDefaultExtensionIcon("widget") into fImg
  put fImg into fTmp
  set the itemdelimiter to "."
  put fImg into fTmp
  replace ".png" with "@extra-high.png" in fTmp
  if there is a file fTmp then put fTmp into fImg
  create invisible img "tmp"
  set the filename of img "tmp" to fImg
  set topleft of img 1 to 0,0
  show img 1
  disable img 1
  set the windowshape of this stack to the ID of image 1
  set the rect of this stack to the rect of image 1
else
 ...
end if
The highlighting of the target stack works but then the dragDrop fails.

How can I solve that?

p.s. Related to that (bug #20377)
shiftLock happens

Locked

Return to “IDE Contributors”