log mouse enter event and position

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
reelstuff
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 254
Joined: Mon Apr 16, 2007 12:06 am
Location: USA
Contact:

log mouse enter event and position

Post by reelstuff » Tue Sep 11, 2007 11:51 am

I am interested in running an experiment, using mouse enter,

Is there a way to log the xy coordinates of the mouse position and save it to a file for examination later?

I would be using a rev browser, calling a rev stack from the Internet or if this is not possible using a rev browser to call an embedded html page and then use mouse enter or other to log the tracking of the mouse.

Any thoughts or suggestions?

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Tue Sep 11, 2007 12:03 pm

Hi reelstuff,

The revBrowser doesn't handle mouseEvents the same way Revolution does. You can get the mouse coordinated with the mouseLoc function, but this will only tell you the location relative to the topleft (= 0,0) of the current window. If a website is too large to fit in the revBrowser object, the browser will have scrollbars and the mouseLoc will not tell you the position of the mouse cursor relative to the browser object.

Maybe you should tell a little more about what you try to achieve and why.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

reelstuff
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 254
Joined: Mon Apr 16, 2007 12:06 am
Location: USA
Contact:

Post by reelstuff » Tue Sep 11, 2007 12:45 pm

Hi, Mark,

Yes, a little research concerning the use of graphic and text to see which graphics and text are more appealing to the end user.

If using rev browser is not effective then perhaps I can find another way to store the html and graphics locally and then find a way to log the mouse info.

perhaps invisible fields over the graphics and text would work or some other variation.

Just formulating a theory and really not sure where to start or if it is even feasible.

thanks for your reply.

Tim

reelstuff
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 254
Joined: Mon Apr 16, 2007 12:06 am
Location: USA
Contact:

a Start, but stuck on collecting the data

Post by reelstuff » Tue Sep 11, 2007 5:58 pm

Hi again,

Ok I have an image field, set to the background, and fields that can collect the data.

Now I need to figure out a way to collect and store that data in an efficient manner.

I know this probably looks like I am up to no good here but this is really a valid experiment for a psychology course I am taking.

The idea is to use ink blots and other graphics then later apply the data collected to see what part of the graphic the student was more interested in looking at.

What attracted the student to a particular portion of the graphic and perhaps even text.

I am kind of lost when trying to find a way to record that data from these fields in an efficient way.

I thought about doing screen shots every so many seconds but that would take up a lot of memory and would not really help much in collecting valid accurate data.

So what I have is six fields, that on mouseenter get the x,y and display in an alternate field.

Code: Select all

on mouseMove x,y
put "mouse over me" && x,y & "." into field feedback2

end mouseMove
this puts the following into the field feedback2
mouse over me 323,246

So I am wondering how is the best way to collect that data, then empty the field, in preparation for the next mouseMove event

Just trying to figure out how I can tell the feedback2 form to put its text into another container, then empty it, until the next mouse over me event, and so on.

Thanks in advance for any thoughts or suggestions.

Tim

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Tue Sep 11, 2007 7:18 pm

Hi Tim,

Why do you want to store the coordinates temporarily in a field?
What do you want to do with the collected coordinated?
Why mouseMove?
Why do you think you can assume that the student will always move the mouse where his or her eyes go?

Then a tiny script:

Code: Select all

global gMouselocs
on recordMouselocs
   if the hilite of btn "Record" is true then --checkbox
     put the mouseloc & cr after gMouseLocs
     put last line of gMouseLocs into fld "Fieldback 2"
     send recordMouseLoc to me in 200 millisecs
   end if
 end recordMouselocs
One more extremely important hint: quotes around field names, and other object names, are obligatory! Seriously, if you don't want to get into trouble later, put quotes around object names now. It also makes your code faster.

I hope this helps.

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

reelstuff
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 254
Joined: Mon Apr 16, 2007 12:06 am
Location: USA
Contact:

Post by reelstuff » Tue Sep 11, 2007 8:02 pm

I think most of this is from a lack of understanding and experience.

on the coordinates, it was all I could think of to try to store the data,

perhaps not the best choice,

Yes your right, it may be quite difficult to get accurate data, considering that the student may not indeed use the mouse as a method of interacting with the graphic.

I am not sure that this is something that can be done accuratly.

But I will say this, it is amazing how far along you can get with a little help, and thank you for the tip on the quotes around field names.


I guess I need something that would encourage interaction between the user the mouse and the eyes.

perhaps use a magnify which the mouse drags and then have them take some action,
to view more of the image.

single click for good perception of image double click for bad perception of image

I am not sure where this is going, but I imagine I will have to really put my thinking cap on.

THanks again

Tim

Post Reply

Return to “Talking LiveCode”