Source language: Translate to:

Timer/Drag&Drop Actions...Best approach.

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

Timer/Drag&Drop Actions...Best approach.

Postby Just4Fun » Sun Apr 11, 2010 6:23 pm

Hi Everyone:

Another question:

I would like to have an event happen after a drag/drop has been completed. what is the best approach to do this?

In a Polygon1 Object, I place the following code in the
Drag/Drop Event: (Start page code sets up the SnapX and SnapY variables.)

Code: Select all

SetVar "[DropX]" "[SnapX]"
SetVar "[DropY]" "[SnapY]"
SetVar "[Tracker]" "1"

TimerStart "Timer3" "1000"


In Timer3, I place this code:

Code: Select all

If "[Tracker]" "=" "1"
ObjectToFront "YouGotIt"
ShowObject "YouGotIt" "Block Dissolve" "7"
endif
SetVar "[Tracker]" "0"


This seems to do what I want, but does it look like the proper way to do it? Is there a better way?

TIA

-Rachel
May I never be cured of my curiosity! ;-)
User avatar
Just4Fun
 
Posts: 136
Joined: Sun Dec 14, 2008 10:05 am
Location: Western Washington, USA

Postby Neosoft Support » Mon Apr 12, 2010 9:57 am

You could try this in the Polygon's Drag Drop action instead:

Code: Select all
SetVar "[DropAccept]" "False"
MoveObject "Polygon1" "[SnapX]" "[SnapY]"
ObjectToFront "YouGotIt"
ShowObject "YouGotIt" "Block Dissolve" "7"
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Postby Just4Fun » Mon Apr 12, 2010 11:40 am

Hi Dave:

No. That approach doesn't work for me because it stops the drop and when I place any code in the drag/drop event, everything happens before the drop, not after it. I need the actions to happen after the drop is completed, but don't know the best way to do this. The timer seems to work, but I have no idea if that is how most people would suggest this be done.

BTW. That randompage listbox sample is really neat. I was having a terrible time figuring out how to keep the random number from regenerating. Thanks for including it in the samples.

Thanks, too, for trying to help me with the drag/drop problem. Hope your day in Oregon is without any rain.

-Rachel
May I never be cured of my curiosity! ;-)
User avatar
Just4Fun
 
Posts: 136
Joined: Sun Dec 14, 2008 10:05 am
Location: Western Washington, USA

Postby Neosoft Support » Mon Apr 12, 2010 11:48 am

It works for me.

I assume what you want is the Polygon object to be moved before the text message is displayed. That's what the modified script does.

Of course, if you prefer to use the Timer instead, there's nothing wrong with that approach.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Postby Just4Fun » Mon Apr 12, 2010 1:09 pm

Hi Dave:

That code did get it for me. I just had to work through a few of my variables and change things around a little. THANK YOU!

I also appreciate you telling me that the timer can also be used for things like this. I wasn't too sure of its application.

I am trying to use the fastest, easiest, and least confusing approach. Yours is that.

As I tinker (never enough time), I'm learning a lot. This is a "most excellent" adventure. ;-)

-Rachel
May I never be cured of my curiosity! ;-)
User avatar
Just4Fun
 
Posts: 136
Joined: Sun Dec 14, 2008 10:05 am
Location: Western Washington, USA


Return to NeoBook Action Commands

Who is online

Users browsing this forum: No registered users and 2 guests