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

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Fasasoftware
Posts: 203
Joined: Mon Oct 31, 2011 9:36 pm
Contact:

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

Post by Fasasoftware » Sun Jun 29, 2014 2:03 pm

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:

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10100
Joined: Fri Feb 19, 2010 10:17 am

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

Post by richmond62 » Sun Jun 29, 2014 2:42 pm

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.
Attachments
locker.livecode.zip
Here is the stack I refer to.
(633 Bytes) Downloaded 238 times

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10331
Joined: Wed May 06, 2009 2:28 pm

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

Post by dunbarx » Sun Jun 29, 2014 3:38 pm

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

Fasasoftware
Posts: 203
Joined: Mon Oct 31, 2011 9:36 pm
Contact:

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

Post by Fasasoftware » Sun Jun 29, 2014 4:40 pm

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

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

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

Post by jmburnod » Sun Jun 29, 2014 5:02 pm

Hi,
What about ?

Code: Select all

set the screenmouseLoc to globalloc(the loc of grc 1)
Best
Jean-Marc
https://alternatic.ch

Fasasoftware
Posts: 203
Joined: Mon Oct 31, 2011 9:36 pm
Contact:

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

Post by Fasasoftware » Sun Jun 29, 2014 9:20 pm

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

Post Reply