Re: Drag-And-Drop Image Fun

2003-06-01 Thread Tuviah M Snyder
Any further hints would be IMMENSELY appreciated!
You could try

setting the dragdata[image] to text of image 1

Only thing is this would override the whole text-image workaround.

image 1 doesn't necessarily need to be PNG, any format will work. Rev
will convert to the native format for the appropriate platform when
dragging (PICT for MacOS, Bitmap for Windows).

Tuviah Snyder [EMAIL PROTECTED] http://www.runrev.com/
Runtime Revolution Limited - Software at the Speed of Thought
___
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution


Drag-And-Drop Image Fun

2003-05-31 Thread dan johnson
Greetings,

I hope you will all tolerate the ignorance of a relatively new user.
I am using REV1.1.1 on Windows XP pro

I didn't read any of the threads about drag-and-drop connected with fields. 
However, after reading this thread on drag-and-drop for images (that has some 
bugs), it isn't exactly clear to me what the goal is. I can think of two 
possible cases with each using 2 possible "images": 1. simply dragging an image 
OR dragging some text (or other object) that represents an image and then 
dropping it into a "target", whereupon the actual image is displayed; 2. same as 
previous description except the Image (or its "reference") get COPIED and you 
drag the copy and drop it. For both cases, if a valid "targit" is not hit, then 
the start condtions are reset (i.e a dragged object gets returned to its start 
location.)

It seems to me that perhaps the routine that Rev already has for cloning by 
holding down the Ctrl key and dragging an object combined with the grab command 
could be modified for this. (Sorry, but I don't know how to "access" the scripts 
in the REV stacks, nor do I have an idea where to look for it even if I knew how 
to access it.)

Just by doing a couple of tests, I see that images can be grabbed and the 
intersect function used to determine if the target was reached. I put several 
empty image objects on a card, put 2 image objects with JPG files in them on the 
card, made a list (using a script) of all the image objects to use as valid 
targits, then grabbed an image and dropped it different places. If it 
intersected with a valid targit, the targit image object was resized to the size 
of the source image, then the imageData put into it. If a valid targit wasn't 
hit, then the source image was returned to its "home" location. This worked fine 
in a card script, so I could grab any of the images on the card. I was able to 
do it within the script limits of the unlicensed version.

So, while the new function in REV2 would be more convenient to script, it looks 
like you are limited to only PNG files. If I could figure out how to do a 
drag-and-drop of an image, then I'm sure any of you experienced programmers 
could write with ease a good script to do it and get around the PNG 
limitiation.

(Sorry if this is a little long winded. I don't make many posts, so I think my 
word count per month is still far below many other people's. LOL)

Dan J.



http://Game.37.com/  <--- Free Games
http://newJoke.com/   <---  J O K E S  ! ! !


Re: Drag-And-Drop Image Fun

2003-05-31 Thread Igor Couto
Hello, Tuviah!

Thank you so much for the feedback! - This was driving me insane!

On Thursday, May 29, 2003, at 09:10  PM, Tuviah M Snyder wrote:

Just tested it and there seems to be a bug where dragging and dropping
images within Rev does not work. Will fix for 2.1. This is how it was
supposed to work:
(snip)

I think you were probably typing a bit too fast :-D ... The code for 
the target image should have been:

on dragenter
  if text is among the items of keys(the dragData) then
set the acceptDrop to true
  end if
end dragenter
on dragdrop
  if text is among the items of keys(the dragData) then
put base64decode(the dragdata[text]) into me
  end if
  pass dragdrop
end dragdrop
It works like a charm - for all types of images, not just PNG! However, 
it only works if dragging WITHIN Rev - not if you want to drag your 
picture to another app... The other apps now think we are dragging 
'text'...

Any further hints would be IMMENSELY appreciated!

Many thanks,
--
Igor de Oliveira Couto
--
[EMAIL PROTECTED]
--
___
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Drag-And-Drop Image Fun

2003-05-29 Thread Igor Couto
Dear Robert,

Thank you for your reply:

On Wednesday, May 28, 2003, at 10:59  PM, Robert Brenstein wrote:

I think if you search list archives for DragDrop you will find an 
example of dragging a text or text field.

I have been able to successfully work with drag-and-drop with text, but 
not with PICTURES. My original posting, in regards to the 2 problems I 
encountered with drag-and-drop:

PROBLEM 1:
I'm having trouble dragging IMAGE information. I want to allow the user 
to drag an image onto an 'imageWell' object. I'M STARTING THE DRAG 
INSIDE REVOLUTION, and the dragSource is an image object. The imageWell 
is another image object, and should accept the drag if there is image 
information in the dragged object (the dragData). Upon drop, the 
imageWell should display the image. My problem is that the 
documentation is a bit unclear as to WHAT exactly it is that I should 
be putting into the dragData[image].  The documentation merely states 
the the dragData[image] should contain 'an image in PNG format'. So, 
here is what I tried:

a) Make new stack. Place a ',png' image in it (our 'source'), and place 
an 'empty' image object somewhere else in the card (our 'target' 
object) - which will be our 'imageWell'.

b) In the source image, as per instructions in the language guide, I 
added the following script:

on mouseDown
   set the dragData[image] to me
end mouseDown
c) In the target image, I added the following script:

on dragEnter
   if dragData[image' is not empty then set the showBorder of me to 
true
end dragEnter

on dragLeave
   set the showBorder of me to false
end dragLeave
on dragDrop
  put dragData[image] into me
end dragDrop
This doesn't work. It appears that dragData[image] is empty, as there 
is no change in the appearance of the target image. So I tried changing 
mouseDown handler of the source image, so that what is stored is the 
'imageData':

on mouseDown
   set the dragData[image] to the imageData of me
end mouseDown
No change - except that it does something nasty to Revolution (changes 
cursors, slows it down) and I have to quite and re-launch... I cannot 
find any other hints in the documentation as to what it is that I 
should be doing. Could anyone shed some light?

PROBLEM 2:
In MacOS X, when a user drags an item, there is usually quite a bit of 
visual feedback given to the user. When a user is dragging something, 
there is usually a transparent image right underneath the cursor, 
giving the user some visual hint as to WHAT is being dragged.
It seems to me that in RunRev, the only visual feedback we can give the 
user is by changing the cursor image... Is that correct? - or would 
there be a way to drag a custom 'transparent image', like in OS X, 
while dragging between windows and applications?

Any suggestions or hints on either problem much appreciated.

--
Igor de Oliveira Couto
--
[EMAIL PROTECTED]
--
___
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Drag-And-Drop Image Fun

2003-05-29 Thread Yves COPPE

I have been able to successfully work with drag-and-drop with text, 
but not with PICTURES. My original posting, in regards to the 2 
problems I encountered with drag-and-drop:



Hi Igor

I've asked on this list to jan Schenkel to write a nioce code for 
drag 'n drop for text, from one fld to another.
I gave us a wonderful code, with a fantastic user interface.

Perhaps he could do the same with image ?

Hey Jan, are you ready ???
--
Greetings.
Yves COPPE

Email : [EMAIL PROTECTED]
___
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Drag-And-Drop Image Fun

2003-05-29 Thread Jan Schenkel
--- Yves COPPE [EMAIL PROTECTED] wrote:
 
 I have been able to successfully work with
 drag-and-drop with text, 
 but not with PICTURES. My original posting, in
 regards to the 2 
 problems I encountered with drag-and-drop:
 
 
 
 Hi Igor
 
 I've asked on this list to jan Schenkel to write a
 nioce code for 
 drag 'n drop for text, from one fld to another.
 I gave us a wonderful code, with a fantastic user
 interface.
 
 Perhaps he could do the same with image ?
 
 Hey Jan, are you ready ???
 -- 
 Greetings.
 
 Yves COPPE
 

Eep, why is everyone looking at me for examples ?
*hides under his desk*
Seriously now, apart from a simple test stack to check
a few things, I haven't used the new drag'n'drop
features all that much ; the stack for drag'n'drop
between list fields doesn't use the standard messages
; and graphics/multimedia isn't really my field.

However, here's my take on things (UNTESTED) :
- since it wants .PNG formatted image data, you'll
need to convert both its imageData _and_ its
maskData/alphaData into that format
- you might want to look at the 'export' command in
the dictionary ; it allows you to export to a file or
even a container in a certain format (aha!)
- you can then stuff this in the dragData[image] and
give it a whirl.

As for visual interaction, that's a whole different
ballpark. If you're only dragging between image
controls on the same card, then here's another
UNTESTED idea :
- temporarily create a new image control of the same
size as the source, 
- set its imageData to the imageData of the source and
its alphaData too
- tinker its blendLevel so its more translucent

And either :
- in the card script, trap the dragMove message and
set the location of the temp image to something around
the mouseLoc
- or start a 'send in 5 milliseconds' cycle to
accomplish the same movement of the temp image


Hope this gets you closer to a solution.

Jan Schenkel.

=
As we grow older, we grow both wiser and more foolish at the same time.  (La 
Rochefoucauld)

__
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com
___
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Drag-And-Drop Image Fun

2003-05-29 Thread Tuviah M Snyder
However, here's my take on things (UNTESTED) :
- since it wants .PNG formatted image data, you'll
need to convert both its imageData _and_ its
maskData/alphaData into that format
- you might want to look at the 'export' command in
the dictionary ; it allows you to export to a file or
even a container in a certain format (aha!)
- you can then stuff this in the dragData[image] and
give it a whirl.
Just tested it and there seems to be a bug where dragging and dropping
images within Rev does not work. Will fix for 2.1. This is how it was
supposed to work:

source image:

on mousedown
set the dragdata[image] to the text of me -- where me is an
image
end mousedown

target image:

on dragenter
if image is among the items of the keys(the dragdata) then --if
image is one of the available drag types
set the acceptdrops to true
end if
end dragenter

on dragdrop
 if image is among the items of the keys(the dragdata) then
put the dragdata[image] into me
end if
pass dragdrop
end dragdrop

The workaround is:

on mousedown
set the dragdata[text] to base64encode(the text of me)
--base64encode binary data as text
end mousedown

target image:

on dragenter
if text is among the items of the keys(the dragdata) then
set the acceptdrops to true
end if
end dragenter

on dragdrop
 if text is among the items of the keys(the dragdata) then
put base64decode(the dragdata[image]) into me
end if
pass dragdrop
end dragdrop

 
Tuviah Snyder [EMAIL PROTECTED] http://www.runrev.com/
Runtime Revolution Limited - Software at the Speed of Thought
___
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution