Source language: Translate to:

drag'n drop ++

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

drag'n drop ++

Postby jide » Sat Oct 21, 2006 6:45 am

Hello everybody,

My question about an educative application using drag and drop : can the same draggable object drop on several targets ? How, please.

Thanks. Greetings from France
jide
 
Posts: 29
Joined: Mon Apr 11, 2005 12:37 pm
Location: FRANCE

Postby Gaev » Sat Oct 21, 2006 7:40 am

jide:
can the same draggable object drop on several targets ?
... do you mean ...

a) allowed to drop on one of several defined target objects ?

or

b) when user releases mouse button, image in object being dragged simultaneously appears in several targets ?
User avatar
Gaev
 
Posts: 3733
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby jide » Sat Oct 21, 2006 8:39 am

Hi, Gaev. I remember your precious contribution...

I mean allowed to drop on one of several defined target objects.

Thanks very much

Jide
jide
 
Posts: 29
Joined: Mon Apr 11, 2005 12:37 pm
Location: FRANCE

Postby Gaev » Sat Oct 21, 2006 9:57 am

jide:

The text may be different in French version of NeoBook but look at the Drag and Drop Mode: property in the Drag and Drop section of the Polygon/Hotspot object ... the third option is Automatic (object can only be dropped in the objects listed below) ... choose this option and add the desired target objects.
User avatar
Gaev
 
Posts: 3733
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby jide » Sat Oct 21, 2006 10:45 am

Ok, Gaev

...Automatic (object can only be dropped in the objects listed below) I see...

BUT

if the draggable object is correctly dropped, it is not available for dropping on an another target.

Is the solution in several copies of the same draggable object (for example, three copies for three targets must accept the same draggable object) ?

Do you understand my "english word" ?

Jide
jide
 
Posts: 29
Joined: Mon Apr 11, 2005 12:37 pm
Location: FRANCE

Postby Gaev » Sat Oct 21, 2006 11:07 am

jide:
Is the solution in several copies of the same draggable object (for example, three copies for three targets must accept the same draggable object) ?

Yes ... one solution would be to have ...

CopyA: defined to have TargetA, TargetB and TargetC as valid objects in its list
CopyB: defined to have TargetA, TargetB and TargetC as valid objects in its list
CopyC: defined to have TargetA, TargetB and TargetC as valid objects in its list

... alternately, you might use just one source object ...

SourceA: defined to have TargetA, TargetB and TargetC as valid objects in its list

... then, each time SourceA is dropped into one of the Target objects, you "clone" the target object's properties (e.g. its size, image/text etc.) ... so they are identical to the Source object ... and then move SourceA back to its original position ... so it is available for another "drag and drop" operation by user.
User avatar
Gaev
 
Posts: 3733
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby jide » Sat Oct 21, 2006 1:18 pm

Gaev,

Your alternative "vision" is very interesting. I hope to work it. I try it.

Bye for now. Thanks a lot.

Jide
jide
 
Posts: 29
Joined: Mon Apr 11, 2005 12:37 pm
Location: FRANCE

Postby jide » Fri Oct 27, 2006 7:29 am

Hi,

The first solution works perfectly (I would like to post a .pub file, but I don't know how to do...).

Starting from the alternative proposition (by Gaev), I try this :

- I put a copy of SourceA behind TargetA ; when SourceA is dropped into TargetA, the copy of SourceA comes in front of TargetA (using the command ObjectToFront) ;

BUT

- the SourceA doesn't move back to its original position (for another "drag and drop" operation), it is attached in TargetA.

I would like very much THIS alternative works...

Help me, please. Thanks.

Jide
jide
 
Posts: 29
Joined: Mon Apr 11, 2005 12:37 pm
Location: FRANCE

Postby Gaev » Fri Oct 27, 2006 9:40 am

Jide:
the SourceA doesn't move back to its original position (for another "drag and drop" operation), it is attached in TargetA.

I would like very much THIS alternative works...
... when you first position SourceA where you want it to be ...
Code: Select all
GetObjectInfo "SourceA" "Left" "[SourceA_Left]"
GetObjectInfo "SourceA" "Top" "[SourceA_Top]"
... if it is set in the proper place at design time, this code can go in the Book's StartUp section.

Now, when the user drops SourceA over one of the targets ... in the Drag Drop section ...
Code: Select all
MoveObject "[SourceA_Left]" "[SourceA_Top]"



By the way, you don't need the ObjectToFront command with this design ... also, the Polygon/Hotspot object has a property defined as "Bring object to front after drop" ... which you can also turn on (check) at design time.
User avatar
Gaev
 
Posts: 3733
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby Neosoft Support » Fri Oct 27, 2006 11:40 am

- the SourceA doesn't move back to its original position (for another "drag and drop" operation), it is attached in TargetA.


You can also leave the drag object in its original position by adding the following to the object's "Drag Drop" action:

Code: Select all
SetVar "[DropAccept]" "False"
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5603
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Postby jide » Fri Oct 27, 2006 11:40 pm

So, you give me interesting trails to "new horizons"...

Thanks a lot. Greetings from France.
jide
 
Posts: 29
Joined: Mon Apr 11, 2005 12:37 pm
Location: FRANCE

Postby jide » Sat Oct 28, 2006 6:31 am

Hello, Gaev

I'm sorry... The MoveObject code doesn't work. SourceA goesn't to its original position. What do I forget to do ?
(It seems I respect your guideline)

Jide
jide
 
Posts: 29
Joined: Mon Apr 11, 2005 12:37 pm
Location: FRANCE

Postby Gaev » Sat Oct 28, 2006 7:33 am

Jide:
The MoveObject code doesn't work. SourceA goesn't to its original position. What do I forget to do ?
... just before the MoveObject command insert this command (temporary) ...
Code: Select all
AlertBox "SourceA" "[SourceA_Left] ... [SourceA_Top]"
... and report the values reported in the popup box ... along with values reported by NeoBook for the same object in the IDE (design time).

P.S. The solution suggested by NeoSoft Support should also work ... and is more elegant.
User avatar
Gaev
 
Posts: 3733
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby jide » Sat Oct 28, 2006 8:48 am

With the solution suggested by Neosoft support

Primary, look at this screen capture (for an example) :

Image

The game player must pursue the logical continuation...

Using Neobook, I put blue circle (or red circle) in back of every grey circle.

Here is the code assigned to the blue draggable object (in the DragDrop section) :

Code: Select all
Setvar "[DropAccept]" "False"

If "[DropTarget]" "=" "bleu1"
ObjectToFront "appbleu1"
EndIf

If "[DropTarget]" "=" "bleu2"
ObjectToFront "appbleu2"
EndIf


...and to the red draggable object :

Code: Select all
Setvar "[DropAccept]" "False"

If "[DropTarget]" "=" "rouge1"
ObjectToFront "approuge1"
EndIf

If "[DropTarget]" "=" "rouge2"
ObjectToFront "approuge2"
EndIf

If "[DropTarget]" "=" "rouge3"
ObjectToFront "approuge3"
EndIf


So, my code is not "really optimized" (?), but it plays with satisfaction.

Thanks you +++
jide
 
Posts: 29
Joined: Mon Apr 11, 2005 12:37 pm
Location: FRANCE


Return to NeoBook Action Commands

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest