Page 1 of 1

How to point the cursor to an object inside the main window?

Posted: Sun Jun 29, 2014 2:03 pm
by Fasasoftware
Dear friend,

How to point the cursor to an object inside the main window?

I have tryed everything... but i can't solve this

In my script ...the cursor change the position but in a wrong coordinate and don't go at the graphic "oval"

here my code:

Code: Select all

local coordinate

on mouseUp
   put the loc of graphic "oval" into coordinate
   set  the screenmouseloc to coordinate
end mouseUp
can you help me please?? Thanks A lot

Lestroso :oops:

Re: How to point the cursor to an object inside the main win

Posted: Sun Jun 29, 2014 2:42 pm
by richmond62
I just made a stack with an OVAL graphic
and set the screenMouseLoc to the loc of the graphic,
and it moved the location of the pointer to the location on
the screen and NOT the location relative to the stack.

Therefore you have to take into account where the stack is on the screen:

The stack is called "LOCKER", it contains one oval graphic "gOVAL"

and a button that contains this script:

on mouseUp
put item 1 of the loc of graphic "gOVAL" into inOVAL
put item 2 of the loc of graphic "gOVAL" into upOVAL
put item 1 of the topLeft of stack "LOCKER" into inLOCK
put item 2 of the topLeft of stack "LOCKER" into upLOCK
set the screenMouseLoc to ((inLOCK + inOVAL),(upLOCK + upOVAL))
end mouseUp

I am attaching the stack here for your convenience.

Re: How to point the cursor to an object inside the main win

Posted: Sun Jun 29, 2014 3:38 pm
by dunbarx
Hi.

Just a little more compact:

Code: Select all

   set the screenmouseLoc to the left of this stack + the left of grc 1 & "," &  the top of this stack + the top of grc 1
This gives you to topleft corner. But you get the idea.

Craig Newman

Re: How to point the cursor to an object inside the main win

Posted: Sun Jun 29, 2014 4:40 pm
by Fasasoftware
Dear richmond62 and dunbark .....many thanks to you!!!

You have solved in full my problem!!!

I don't have any words to thank you....

Best regards,

Lestroso :D

Re: How to point the cursor to an object inside the main win

Posted: Sun Jun 29, 2014 5:02 pm
by jmburnod
Hi,
What about ?

Code: Select all

set the screenmouseLoc to globalloc(the loc of grc 1)
Best
Jean-Marc

Re: How to point the cursor to an object inside the main win

Posted: Sun Jun 29, 2014 9:20 pm
by Fasasoftware
Dear Jean-Marc,

your script is the best!!!! Only few commands and run perfectly!!!!

But i want to thank you everybody!!! Very Kind support...

Best regards,

Lestroso :D :D :D