I still can't get it to work. Jacque, thanks for the tip about the allowableDragActions -- that makes the copy vs move part work reliably. But no matter what I do I can't set the dragdata (or the dragdata["text"]) to a modified text string and get it to drop into the target field. I've tried transforming the text in a dragStart handler per Eric's suggestion and setting the dragdata then, I've tried doing it in a dragEnter in the target field script. I even tried using a global, myDragData, that is set in the drag start and then in the dragenter handler I set the dragdata["text"] to myDragData. All fail. No matter what I do I have not been able to *set* the dragData or the dragData["text"] to any string and have it actually drop that string into my target field. It's acting as though the 'set the dragData...' command is ignored no matter where I try to do it.

Also, an empty dragDrop handler in the target field blocks the drop. Doesn't this mean that the dragDrop message is sent *before* the drop? So it still seems to me that if I could set the dragData at all, I ought to be able to do it in the dragDrop handler in the target field. Well, I'll take a look at the tutorial on the subject when I get a moment (I already have a full-time non-rev job...).

Could someone try setting the dragData["text"] to "finally got it to work!" and give me a recipe?

Peter M. Brigham
[EMAIL PROTECTED]

"J. Landman Gay" <[EMAIL PROTECTED]> wrote:

Eric Chatonet wrote:


Sounds better to set all this in a dragStart handler:

on dragStart
  set the dragImage to <ID>
  [set the dragImageOffset to <point>]
  set the dragData[<type>] to <data>
end dragStart

In your case: set the dragData["text"] to Transform(the
dragData["text"]) -- specific function


That didn't work either until I remembered to set the
allowableDragActions. Then it worked.

Peter, try that. I was getting bizarre results too until I remembered to set that property in a dragStart handler. It's a new keyword as of 2.9.

One thing I noticed. If I set the allowableDragActions to "move,copy"
(the example in the docs) or "copy,move" it will only move text, even if
the target field sets the dragaction to "copy".

--
Jacqueline Landman Gay         |     [EMAIL PROTECTED]
HyperActive Software           |     http://www.hyperactivesw.com


Peter M. Brigham wrote:

I am trying to modify the dragdata before a text string is dropped,
and it's not working, so I must be doing something wrong. The idea is
for the user to select some text from one field (unlocked), and drag
it to to a target field (unlocked), and I want to insert a tab in
place of a space in the text and drop the modified text into the
target field. Both fields are in the same group on the same card.
Here's my script (in the target field):

on dragDrop
   set the dragaction to "copy"
   put the dragData into mLine -- works fine, so does using the
'dragData["text"]'
   set the itemdelimiter to tab
   put item 2 of mLine into mChunk
   put length(word 1 of mChunk) into w
   put tab into char w+1 of mChunk
   put mChunk into item 2 of mLine
   set the dragdata to mLine
   -- set the dragdata["text"] to mLine -- I tried this too
   pass dragDrop
end dragDrop

There are no other handlers in the script, and no other dragdrop
handlers in the group, card, or stack scripts.

The original selected text is dropped without modification into the
target field. The dragDrop handler is getting triggered, since
setting a breakpoint and doing the drag-drop opens up the script in
the debugger, and the data is manipulated correctly as I step through
the script, so at the end mLine contains the proper string -- but the
original string is what appears in the target field, even when I
substitute 'set the dragdata to "something inane"'. So the command
'set the dragData to...' is being ignored, apparently.

I tried instead modifying the dragdata in a dragStart handler in the
starting field, but it seems that the dragdata is not yet set at that
point, since "put the dragdata into mLine" shows mLine = empty in the
debugger, which doesn't really make sense -- shouldn't the engine
know by that point what the dragdata is?

I tried putting a 'wait 25 millisecs with messages' line just after
setting the dragdata, before passing the dragdrop, figuring maybe
setting the dragdata property takes a little time for some reason
(but why should it?) -- still no go.

Uh oh, another problem -- suddenly, setting the dragAction to "copy"
now doesn't work. I swear it was working before. I just tried setting
the dragaction in a dragstart handler and in a dragleave handler in
the starting field, as well as in the dragdrop handler in the target
field, but in all cases the text is moved instead of being copied,
unless of course I hold down the optionkey. I *swear* it was working
properly before...! Oh -- the problem is the wait with messages
command that I just put in -- this apparently allows the dragaction
to reset to "none." When I take out the wait command the text is
copied and not moved. Well, that's a relief. But the original problem
remains.

This is the first time I've messed around with drag/drop, but there
seems to be a problem setting the dragddata. Is there something I'm
overlooking? I'm using a Mac iBook G4, OSX 10.4.1, Studio 2.9 build
610. Running in the IDE -- but suspending development tools doesn't
work, so it's not an obvious IDE problem. Restarting Rev didn't do it
either. Help!


_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to