Re: Mouse messages while down
On 3/18/07 12:12 AM, Sarah Reichelt [EMAIL PROTECTED] wrote: I'm now doing the politically correct mouseMove instead of using repeat while mouse is down. But it still leaves me having to check the location all the time to see whether it is inside one of my 400 buttons. It seems that the mouseControl should be able to report where the mouse is without me having to check it manually. But mouseControl gets stuck when you click down and never changes until the mouse comes up again. Here's another technique for identifying the object at the mouseLoc. This technique is different because it works with no repeat loop, no checking the visible or the rect of any object, no formulas based on the mouseLoc, and no reference to the mouseControl. Create a button named mouseObject with the following script: -- script local sMouseObject on mouseObject if line 1 of the frontscripts is not long id of me then insert script of me into front lock screen click at the mouseloc unlock screen remove script of me from front return sMouseObject end if end mouseObject on mousedown end mousedown on mouseUp put long id of the target into sMouseObject end mouseUp -- script/ Then to test it, put the following handler into the stack script: -- script on mouseMove call mouseObject of button mouseObject of me put the result end mouseMove -- script/ The technique passed my tests. Does it work for you? -- Dick ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Mouse messages while down
I thought this sort of polling was not considered a good idea. It seems fine on my 2GHz Intel Mac, but I'm not sure how it would go on slower machines. It still seems odd that I can't get the data I need without having to do this. Yeah, bad idea. At least, according to Mr. Raney. Sometimes it's the only way though. A more politically correct way is to use a mousemove handler. Set a script local when the mouse goes down or up. Then use mousemove to check whether the variable flag is set. If not, pass mousemove. If so, check the mouse location. Off the top of my head: The top of your head worked fine thanks Jacque :-) I'm now doing the politically correct mouseMove instead of using repeat while mouse is down. But it still leaves me having to check the location all the time to see whether it is inside one of my 400 buttons. It seems that the mouseControl should be able to report where the mouse is without me having to check it manually. But mouseControl gets stuck when you click down and never changes until the mouse comes up again. Thanks to everyone for their thoughts and suggestions. Cheers, Sarah ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Mouse messages while down
On 3/18/07 12:12 AM, Sarah Reichelt [EMAIL PROTECTED] wrote: snip But it still leaves me having to check the location all the time to see whether it is inside one of my 400 buttons. snip/ Hi, Sarah. You could build an array using points as keys, so that when you look up any x,y pair you get the control id. If that would use too much memory, you could build two arrays, one for x and one for y. If the x array identifies for each value of x the controls that share that value of x, any the y array is analogous, then intersecting of the values for the current x with the values for the current y would yield the current control id. For buttons in a simple arrangement, you could probably use even less memory. Whichever design you choose, you could store the arrays as custom property sets of the card, so your user could never perceive the delay even for a huge number of buttons. Of course you'd need to rebuild the arrays if you move a button. Do you feel the need the speed enough to write the code? -- Dick ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Mouse messages while down
Recently, Sarah Reichelt wrote: It seems that the mouseControl should be able to report where the mouse is without me having to check it manually. But mouseControl gets stuck when you click down and never changes until the mouse comes up again. You may not be able to check the mouseControl while the mouse is pressed, but you *can* check the mouse position on mouseMove while the mouse is down. The main reason to avoid polling is because you have 400 objects to check -- it could be demanding and possibly prevent stuff from executing. But you could establish a coordinate grid defined by the rects of the buttons, and monitor the X,Y in a mouseMove handler. Assume a grid of btns on a card: a1 b1 c1 d1 a2 b2 c2 d2 a3 b3 c3 d3 Put the following in the card script (actual mouseMove code would be more efficient): local W,H,L,T,gridRect,checkPos on mouseDown put width of btn 1 into W put height of btn 1 into H put left of btn 1 into L put top of btn 1 into T put L,T,(L+4*W),(T+3*H) into gridRect put true into checkPos end mouseDown on mouseMove X,Y if not checkPos then pass mouseMove if not (X,Y is within gridRect) then put pass mouseMove end if if X (L+4*W) then put d into btnX if X (L+3*W) then put c into btnX if X (L+2*W) then put b into btnX if X (L + W) then put a into btnX # if Y (T+3*H) then put 3 into btnY if Y (T+2*H) then put 2 into btnY if Y (T + H) then put 1 into btnY put Mouse is within button btnX btnY end MouseMove on mouseUp endCheck end mouseUp on mouseRelease endCheck end mouseRelease on endCheck put false into checkPos put end endCheck This should monitor the mouse position relative to each button. Hope this helps. Regards, Scott Rossi Creative Director Tactile Media, Multimedia Design - E: [EMAIL PROTECTED] W: http://www.tactilemedia.com ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Mouse messages while down
There's another fly in the ointment. Using within works reliably only if no buttons are overlapping (it doesn't respect layering like messages would), and the coordinate approach only works if the buttons are in a grid. If you have a more involved setup like using irregular graphics for the regions, invisible or disabled objects, etc it can get complicated. The DragDrop family of messages would seem ideal; but those only work with text. :/ ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Mouse messages while down
Sarah, 400 individual buttons is bad design. Draw a grid and use a mouseDown handler if you want to store the clicked location. Use the mouseRelease handler to get the new location. Calculate in which rectangle the new mouseLoc is, without a repeat loop. I am sure you can do this. Best regards, Mark -- Economy-x-Talk Consultancy and Software Engineering http://economy-x-talk.com http://www.salery.biz Get your store on-line within minutes with Salery Web Store software. Download at http://www.salery.biz Op 18-mrt-2007, om 8:12 heeft Sarah Reichelt het volgende geschreven: The top of your head worked fine thanks Jacque :-) I'm now doing the politically correct mouseMove instead of using repeat while mouse is down. But it still leaves me having to check the location all the time to see whether it is inside one of my 400 buttons. It seems that the mouseControl should be able to report where the mouse is without me having to check it manually. But mouseControl gets stuck when you click down and never changes until the mouse comes up again. Thanks to everyone for their thoughts and suggestions. Cheers, Sarah ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
RE: Mouse messages while down
Hi Sarah: Depending on the arrangement and characteristics of your 400 controls, you could take the approach of putting mouse detection in an image above your buttons instead of in a card script below: Create a one-bit mask...with areas in the image that register with buttons being made opaque, other areas being transparent. In Rev set the blendlevel of the image to 100. The entire image will be visually transparent, but mouse clicks will respect *original* opacity/transparency. Therefore in the script of the image you could have something like this: on mouseDown --detectable in opaque areas only put BtnBelowAtMouseDown() into gBtnDown set the hilite of btn gBtnDown to true end mouseDown on mouseRelease set the hilite of btn gBtnDown to false end mouseRelease on mouseUp set the hilite of btn gBtnDown to false send mouseUp to btn gBtnDown -- if needed end mouseUp on mouseMove put BtnBelowAtHover() into tBtnHovered ... end mouseMove The BtnBelowAtMouseDown and BtnBelowAtHover algorithms depend a lot on card design. I have done something similar, but with 4 underlying controls instead of 400 so I am not sure about performance and the efficiency of those two algorithms in your particular case. A compelling feature of this approach is that the creation of the mask itself could be scriptable...using snapshot, button rects, alphadata, etc...though I have never done it. Mark ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Mouse messages while down
I prefer the method Bill Marriott suggested: set a global (or a script local) on a mouseDown event and then track the coordinates via mouseMove. You can theoretically track the location of the mouse (pointer) during mouseMove without using a local or global in a mouseDown handler, but then you have to use the mouse is down to test within the mouseMove handler, and that can be problematic as it tends to eat the mouseUp message and is generally inefficient, in my experience. Best, Jerry Daniels Makers of Galaxy 1.5 http://www.daniels-mara.com/new_in_galaxy_1_5.htm On Mar 17, 2007, at 11:03 PM, Stephen Barncard wrote: Jerry figured it out a while ago -- Galaxy always shows the object name and path of the object it is hovering above. I think mousemove may be part of it. from the docs: Sent periodically while the mouse button is being held down. this gets close to what you want I think. ON mouseMove put the target END mouseMove It still seems odd that I can't get the data I need without having to do this. Cheers, Sarah -- stephen barncard s a n f r a n c i s c o - - - - - - - - - - - - ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Mouse messages while down
Galaxy always shows the object name and path of the object it is hovering above. I think mousemove may be part of it. This is an interesting topic to me. One that doesn't necessarily deal with Sarah's original question, but for the sake of accuracy--and possible interest--I want to report how Galaxy has has in the past and is presently figuring out what object is beneath the pointer? The cursory inspection that Galaxy 1.5 has done to detect what object you're over came from Galaxy's pinging or sending out periodic messages constantly. Why not just use mouseMove? We pinged so that Galaxy could also detect when you were above the title bar of a stack and then report the stack name and path in the status fields of Galaxy Bar. The mouseMove tracking would not report when the pointer was in the title bar of a stack. We also used the ping method so users could hold down command + option to then edit of the script of an object. This is only needed because Rev running on the Mac cannot detect the depression of the modifier keys (command, option, shift, control) without also depressing a typeable key. But even on Windows, it is sometimes difficult to get Revolution to report a keydown if there isn't an editable field around in an open stack. You'll notice I am using the past tense in describing the ping method of object inspection. We switched over to a new approach to solving this problem because pinging was very inefficient, especially on older, slower machines. The more recent versions of Galaxy 1.5 use the pepper ping approach. With this method, cursory and in-depth inspection occurs only when the mouse is moving AND up to 5 seconds after the mouse stops moving. When the mouse stops moving, Galaxy peppers the object beneath the pointer with a series of pings (send glxInspectObject in 250 millisecs) over a period of 5 seconds to see if you're going to hold down some modifier keys and also in case you moved the pointer to the title bar of a stack. How does one detect if the mouse has stopped moving? By canceling messages! (See script below.) The pepper method (invented after drinking a Dr. Pepper soft drink?) results is far less system activity, near instant reporting of the object name and path in Galaxy Bar, and very snappy in-depth inspection that leads to editing the object. The only time a veteran user of Galaxy might notice our change in methods is when using no- click inspection to edit the script of an object, and mouse has been stationary for longer than 5 seconds--something that doesn't seem to happen as often as one would think. Here is the crucial code from our front script (distilled for our purposes here) that does does the pepper ping thing: on mouseMove theH,theV put the cGlxInspect of stack revGalaxy inspector into doInspect if doInspect is true then glxSendStaggeredInspectMsg end IF pass mouseMove end mouseMove on glxSendStaggeredInspectMsg -- get rid of lingering messages for efficiency... -- and to detect if mouse has stopped moving: glxCancelPendingInspectMsgs -- respond right away: send glxInspectObject to me in 10 millisecs -- begin the peppering: put 0 into theNoMillisecs put 250 into theInterval repeat for 19 add theInterval to theNoMillisecs send glxInspectObject to me in theNoMillisecs millisecs end repeat end glxSendStaggeredInspectMsg on glxCancelPendingInspectMsgs -- luckily, Rev does all this very fast, indeed: put the pendingmessages into thePendingMessages filter thePendingMessages with *,glxScriptEdit,* repeat for each line thePendingMessage in thePendingMessages -- use token and don't worry about itemDel: put token 1 of thePendingMessage into theMsgID cancel theMsgID end repeat end glxCancelPendingInspectMsgs on glxInspectObject -- get long id of object, even if pointer is in title bar: put glxGetObjectBeneathPointer() into theObjectID edit the script of theObjectID end glxInspectObject Best, Jerry Daniels Makers of Galaxy 1.5 http://www.daniels-mara.com/new_in_galaxy_1_5.htm On Mar 17, 2007, at 11:03 PM, Stephen Barncard wrote: Jerry figured it out a while ago -- Galaxy always shows the object name and path of the object it is hovering above. I think mousemove may be part of it. from the docs: Sent periodically while the mouse button is being held down. this gets close to what you want I think. ON mouseMove put the target END mouseMove It still seems odd that I can't get the data I need without having to do this. Cheers, Sarah -- stephen barncard s a n f r a n c i s c o - - - - - - - - - - - - ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
Re: Mouse messages while down
Jerry, would this explain the 'flickering' that I've seen in your tooltips field in earlier versions of Galaxy? This would only happen when Galaxy was kept running for hours and days... Restarting Rev always fixed it. The cursory inspection that Galaxy 1.5 has done to detect what object you're over came from Galaxy's pinging or sending out periodic messages constantly. Why not just use mouseMove? We pinged so that Galaxy could also detect when you were above the title bar of a stack and then report the stack name and path in the status fields of Galaxy Bar. The mouseMove tracking would not report when the pointer was in the title bar of a stack. Jerry Daniels Makers of Galaxy 1.5 http://www.daniels-mara.com/new_in_galaxy_1_5.htm On Mar 17, 2007, at 11:03 PM, Stephen Barncard wrote: Jerry figured it out a while ago -- Galaxy always shows the object name and path of the object it is hovering above. I think mousemove may be part of it. from the docs: Sent periodically while the mouse button is being held down. -- stephen barncard s a n f r a n c i s c o - - - - - - - - - - - - ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Mouse messages while down
On 3/18/07 7:56 AM, Jerry Daniels [EMAIL PROTECTED] wrote: snip on glxInspectObject -- get long id of object, even if pointer is in title bar: put glxGetObjectBeneathPointer() into theObjectID edit the script of theObjectID end glxInspectObject snip/ Hi, Jerry. How does glxGetObjectBeneathPointer() work? I searched the Galaxy scripts and didn't find it. -- Dick ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Mouse messages while down
Dick, I indicated in my posting that I had distilled portions for simplicity. Look at the glxScriptEdit handler in the inspection folder in the frontScript. I't s quite large and has barnacles on it. You'll see how I determine the long id of the object below the pointer--including stacks. Best, Jerry Daniels Tool makers for the 21st century http://www.daniels-mara.com Voice: 512.879.6286 Skype: jerry.daniels On Mar 18, 2007, at 4:31 PM, Dick Kriesel wrote: On 3/18/07 7:56 AM, Jerry Daniels [EMAIL PROTECTED] wrote: snip on glxInspectObject -- get long id of object, even if pointer is in title bar: put glxGetObjectBeneathPointer() into theObjectID edit the script of theObjectID end glxInspectObject snip/ Hi, Jerry. How does glxGetObjectBeneathPointer() work? I searched the Galaxy scripts and didn't find it. -- Dick ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Mouse messages while down
Stephen, The flicker we used to see was related, i believe, to a mouseWithin message gone bad. Best, Jerry Daniels Makers of Galaxy 1.5 http://www.daniels-mara.com/new_in_galaxy_1_5.htm On Mar 18, 2007, at 1:13 PM, Stephen Barncard wrote: Jerry, would this explain the 'flickering' that I've seen in your tooltips field in earlier versions of Galaxy? This would only happen when Galaxy was kept running for hours and days... Restarting Rev always fixed it. The cursory inspection that Galaxy 1.5 has done to detect what object you're over came from Galaxy's pinging or sending out periodic messages constantly. Why not just use mouseMove? We pinged so that Galaxy could also detect when you were above the title bar of a stack and then report the stack name and path in the status fields of Galaxy Bar. The mouseMove tracking would not report when the pointer was in the title bar of a stack. Jerry Daniels Makers of Galaxy 1.5 http://www.daniels-mara.com/new_in_galaxy_1_5.htm On Mar 17, 2007, at 11:03 PM, Stephen Barncard wrote: Jerry figured it out a while ago -- Galaxy always shows the object name and path of the object it is hovering above. I think mousemove may be part of it. from the docs: Sent periodically while the mouse button is being held down. -- stephen barncard s a n f r a n c i s c o - - - - - - - - - - - - ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Mouse messages while down
On Sat, 17 Mar 2007 19:50:40 -0700, Jim Ault wrote: The problem is that no other messages seem to be sent while the mouse is down (mouseEnter, mouseLeave, mouseStillDown etc). I can detect mouseRelease but the target is my original button so it doesn't tell me where the mouse is now. Checking the mouseControl in the mouseRelease handler also gives the original target. It's looking as if I may have to do some continuous polling, but I know that is generally frowned upon, so I would be grateful for any other suggestions. Here's what worked for me (put this in the card script): global gDragging on mouseDown if word 1 of the name of the target is button then put true into gDragging else pass mouseDown end if end mouseDown on mouseMove if gDragging and the mouse is up then send GetTarget to me in 20 milliseconds put false into gDragging end if pass mouseMove end mouseMove on GetTarget try put the short name of the mouseControl -- or anything else you want to do with it catch tError -- it would get here if you released over the card itself end try end GetTarget Hope this works for you... Ken Ray Sons of Thunder Software, Inc. Email: [EMAIL PROTECTED] Web Site: http://www.sonsothunder.com/ ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Mouse messages while down
400 individual buttons is bad design. Draw a grid and use a mouseDown handler if you want to store the clicked location. Use the mouseRelease handler to get the new location. Calculate in which rectangle the new mouseLoc is, without a repeat loop. I am sure you can do this. It's not something I would normally do, but in this particular case, it works very well and allows great flexibility in selection and display. However the buttons are all non-overlapping and in a rectangular grid - not completely regular but nearly so. While checking each rect against the mouse loc works fine on my computer, to allow for slower ones I should put the effort into an algorithm to calculate the correct button instead. Since I originally asked my question, I have progressed to needing to track the button underneath the mouse at all times while the mouse is down, so Jacque's technique is working really well for that. Unlike Jerry's Galaxy scripts, I only need to do this checking while the mouse is down, so it doesn't have to be able to operate while other things are happening. Cheers, Sarah ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Mouse messages while down
I just wanted to throw in my two cents on this thread. When I was working on Pixelution (which is still available on RevOnline) I ran into the problem of figuring out what button the mouse was hovering over when the mouse was down. My troubles lead me to post BugZilla # 3668 (http://quality.runrev.com/qacenter/show_bug.cgi?id=3668) but also lead to a solution that worked well considering that the script would handle polling 1,024 buttons within a group quite efficiently (but nowhere as efficiently as the fulfillment of bug #3668. To solve the problem, I used a combination of a variable containing all of the ID's of the buttons within the group, and a mouseMove handler that would check to see if the mouse was within each button ID when the handler was issued. Also, since the mouse could only be within 1 button in my grid, I had the repeat handler stop polling as soon as it found a button that the mouse was within. Like I said though, it works, but is very limited by the speed of the computer. Derek Bump Dreamscape Software http://www.dreamscapesoftware.com/ ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Mouse messages while down
how about: Use the within function to determine whether a point is inside the specified object. Jim Ault Las Vegas On 3/17/07 7:32 PM, Sarah Reichelt [EMAIL PROTECTED] wrote: I'm having a blank moment here and I can't work out how to solve what should be a simple problem. I have a grid of about 400 buttons and I have a mouseDown handler in the card script to detect which of these buttons is clicked first. Then I want the user to be able to drag the mouse around and I want to detect which button is under the pointer when the mouse is released. Ideally, I want to detect which button is under the pointer at all times while the mouse is down. The problem is that no other messages seem to be sent while the mouse is down (mouseEnter, mouseLeave, mouseStillDown etc). I can detect mouseRelease but the target is my original button so it doesn't tell me where the mouse is now. Checking the mouseControl in the mouseRelease handler also gives the original target. It's looking as if I may have to do some continuous polling, but I know that is generally frowned upon, so I would be grateful for any other suggestions. ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Mouse messages while down
Sarah, I don't fully understand what you're trying to do, but something like the following should get you continuous x,y that you should be able to use in some manner or another to determine which button is affected: on mousedown repeat while the mouse is down get the mouseloc -- do something with it end repeat end mousedown Joe Wilkins On Mar 17, 2007, at 7:32 PM, Sarah Reichelt wrote: I'm having a blank moment here and I can't work out how to solve what should be a simple problem. I have a grid of about 400 buttons and I have a mouseDown handler in the card script to detect which of these buttons is clicked first. Then I want the user to be able to drag the mouse around and I want to detect which button is under the pointer when the mouse is released. Ideally, I want to detect which button is under the pointer at all times while the mouse is down. The problem is that no other messages seem to be sent while the mouse is down (mouseEnter, mouseLeave, mouseStillDown etc). I can detect mouseRelease but the target is my original button so it doesn't tell me where the mouse is now. Checking the mouseControl in the mouseRelease handler also gives the original target. It's looking as if I may have to do some continuous polling, but I know that is generally frowned upon, so I would be grateful for any other suggestions. Thanks, Sarah ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Mouse messages while down
Thanks Jim Joe, That works OK, using a repeat while the mouse is down loop and then checking the mouseLoc to see whether it is within the rect of any of my 400 buttons each time. I thought this sort of polling was not considered a good idea. It seems fine on my 2GHz Intel Mac, but I'm not sure how it would go on slower machines. It still seems odd that I can't get the data I need without having to do this. Cheers, Sarah On 3/18/07, Joe Lewis Wilkins [EMAIL PROTECTED] wrote: Sarah, I don't fully understand what you're trying to do, but something like the following should get you continuous x,y that you should be able to use in some manner or another to determine which button is affected: on mousedown repeat while the mouse is down get the mouseloc -- do something with it end repeat end mousedown Joe Wilkins On Mar 17, 2007, at 7:32 PM, Sarah Reichelt wrote: I'm having a blank moment here and I can't work out how to solve what should be a simple problem. I have a grid of about 400 buttons and I have a mouseDown handler in the card script to detect which of these buttons is clicked first. Then I want the user to be able to drag the mouse around and I want to detect which button is under the pointer when the mouse is released. Ideally, I want to detect which button is under the pointer at all times while the mouse is down. The problem is that no other messages seem to be sent while the mouse is down (mouseEnter, mouseLeave, mouseStillDown etc). I can detect mouseRelease but the target is my original button so it doesn't tell me where the mouse is now. Checking the mouseControl in the mouseRelease handler also gives the original target. It's looking as if I may have to do some continuous polling, but I know that is generally frowned upon, so I would be grateful for any other suggestions. Thanks, Sarah ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Mouse messages while down
Sarah, Try this script in the card: -- global trackMouse on mouseDown put true into trackMouse end mouseDown on mouseMove if trackMouse = true then put mouseMove the target return after fld 1 pass mouseMove end if end mouseMove on mouseRelease if trackMouse = true then put mouseRelease the target return after fld 1 pass mouseRelease end if end mouseRelease on mouseLeave if trackMouse = true then put mouseLeave the target return after fld 1 pass mouseLeave end if end mouseLeave on mouseEnter if trackMouse = true then put mouseEnter the target return after fld 1 put false into trackMouse pass mouseEnter end if end mouseEnter -- I think you will find that once you press the mouse button: - mouse down is sent to the original button - mouseMoves are continually sent to the original button wherever you move the mouse - when you release, you get a mouseRelease sent to the original button - then a mouseMove is sent to the button you released over, - then a mouseLeave sent to the original button, - then a mouseEnter sent to the button you released over - Bill Sarah Reichelt [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Thanks Jim Joe, That works OK, using a repeat while the mouse is down loop and then checking the mouseLoc to see whether it is within the rect of any of my 400 buttons each time. I thought this sort of polling was not considered a good idea. It seems fine on my 2GHz Intel Mac, but I'm not sure how it would go on slower machines. It still seems odd that I can't get the data I need without having to do this. Cheers, Sarah On 3/18/07, Joe Lewis Wilkins [EMAIL PROTECTED] wrote: Sarah, I don't fully understand what you're trying to do, but something like the following should get you continuous x,y that you should be able to use in some manner or another to determine which button is affected: on mousedown repeat while the mouse is down get the mouseloc -- do something with it end repeat end mousedown Joe Wilkins On Mar 17, 2007, at 7:32 PM, Sarah Reichelt wrote: I'm having a blank moment here and I can't work out how to solve what should be a simple problem. I have a grid of about 400 buttons and I have a mouseDown handler in the card script to detect which of these buttons is clicked first. Then I want the user to be able to drag the mouse around and I want to detect which button is under the pointer when the mouse is released. Ideally, I want to detect which button is under the pointer at all times while the mouse is down. The problem is that no other messages seem to be sent while the mouse is down (mouseEnter, mouseLeave, mouseStillDown etc). I can detect mouseRelease but the target is my original button so it doesn't tell me where the mouse is now. Checking the mouseControl in the mouseRelease handler also gives the original target. It's looking as if I may have to do some continuous polling, but I know that is generally frowned upon, so I would be grateful for any other suggestions. Thanks, Sarah ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Mouse messages while down
Jerry figured it out a while ago -- Galaxy always shows the object name and path of the object it is hovering above. I think mousemove may be part of it. from the docs: Sent periodically while the mouse button is being held down. this gets close to what you want I think. ON mouseMove put the target END mouseMove It still seems odd that I can't get the data I need without having to do this. Cheers, Sarah -- stephen barncard s a n f r a n c i s c o - - - - - - - - - - - - ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Mouse messages while down
Sarah, By and large, I would not put this in the category of polling; since nothing can be done while the mouse is down anyway. That's just the way it is. Now, if this repeat loop was being used in a mouseup handler, then it would be polling because all sorts of things can take place once the mouse button is released. So, I wouldn't feel badly about using this. Even fairly slow machines are going to react in exactly the same manner. They're just waiting for the user to make up her mind. (smile) Joe Wilkins On Mar 17, 2007, at 8:22 PM, Sarah Reichelt wrote: Thanks Jim Joe, That works OK, using a repeat while the mouse is down loop and then checking the mouseLoc to see whether it is within the rect of any of my 400 buttons each time. I thought this sort of polling was not considered a good idea. It seems fine on my 2GHz Intel Mac, but I'm not sure how it would go on slower machines. It still seems odd that I can't get the data I need without having to do this. Cheers, Sarah On 3/18/07, Joe Lewis Wilkins [EMAIL PROTECTED] wrote: Sarah, I don't fully understand what you're trying to do, but something like the following should get you continuous x,y that you should be able to use in some manner or another to determine which button is affected: on mousedown repeat while the mouse is down get the mouseloc -- do something with it end repeat end mousedown Joe Wilkins On Mar 17, 2007, at 7:32 PM, Sarah Reichelt wrote: I'm having a blank moment here and I can't work out how to solve what should be a simple problem. I have a grid of about 400 buttons and I have a mouseDown handler in the card script to detect which of these buttons is clicked first. Then I want the user to be able to drag the mouse around and I want to detect which button is under the pointer when the mouse is released. Ideally, I want to detect which button is under the pointer at all times while the mouse is down. The problem is that no other messages seem to be sent while the mouse is down (mouseEnter, mouseLeave, mouseStillDown etc). I can detect mouseRelease but the target is my original button so it doesn't tell me where the mouse is now. Checking the mouseControl in the mouseRelease handler also gives the original target. It's looking as if I may have to do some continuous polling, but I know that is generally frowned upon, so I would be grateful for any other suggestions. Thanks, Sarah ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Mouse messages while down
Sarah Reichelt wrote: Thanks Jim Joe, That works OK, using a repeat while the mouse is down loop and then checking the mouseLoc to see whether it is within the rect of any of my 400 buttons each time. I thought this sort of polling was not considered a good idea. It seems fine on my 2GHz Intel Mac, but I'm not sure how it would go on slower machines. It still seems odd that I can't get the data I need without having to do this. Yeah, bad idea. At least, according to Mr. Raney. Sometimes it's the only way though. A more politically correct way is to use a mousemove handler. Set a script local when the mouse goes down or up. Then use mousemove to check whether the variable flag is set. If not, pass mousemove. If so, check the mouse location. Off the top of my head: local sFlag on mouseDown put true into sFlag -- or you could use the button ID as the flag end mouseDown on mouseUp put false into sFlag end mouseUp on mouseMove x,y if sFlag true then pass mouseMove repeat with n = 1 to the number of btns if x,y is within the rect of btn n then put n into tTarget exit repeat end if end repeat end mouseMove I use this method in my Klondike game. -- Jacqueline Landman Gay | [EMAIL PROTECTED] HyperActive Software | http://www.hyperactivesw.com ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Mouse messages while down
Sorry Joe, polling is just plain bad practice and could interfere with other messaging code. Rev gives plenty of ways to deal with messages that one should never have to use idle. You still have your hypercard hat on. Untie the chains! sqb Sarah, By and large, I would not put this in the category of polling; since nothing can be done while the mouse is down anyway. That's just the way it is. Now, if this repeat loop was being used in a mouseup handler, then it would be polling because all sorts of things can take place once the mouse button is released. So, I wouldn't feel badly about using this. Even fairly slow machines are going to react in exactly the same manner. They're just waiting for the user to make up her mind. (smile) Joe Wilkins -- stephen barncard s a n f r a n c i s c o - - - - - - - - - - - - ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Mouse messages while down
Stephen, So you're saying that with Rev, when the Mouse is Down, other messages can still be sent/received unless a repeat loop of the nature I suggested is invoked, so that it IS polling in the sense that it interrupts the normal flow? I guess things have gotten more complicated than I think they should. Of course, that's mostly because I'm content to do one thing at a time. Guess you could say I'm a stick in the mud! Thank for the observations, nonetheless. Joe Wilkins On Mar 17, 2007, at 9:22 PM, Stephen Barncard wrote: Sorry Joe, polling is just plain bad practice and could interfere with other messaging code. Rev gives plenty of ways to deal with messages that one should never have to use idle. You still have your hypercard hat on. Untie the chains! sqb Sarah, By and large, I would not put this in the category of polling; since nothing can be done while the mouse is down anyway. That's just the way it is. Now, if this repeat loop was being used in a mouseup handler, then it would be polling because all sorts of things can take place once the mouse button is released. So, I wouldn't feel badly about using this. Even fairly slow machines are going to react in exactly the same manner. They're just waiting for the user to make up her mind. (smile) Joe Wilkins -- stephen barncard s a n f r a n c i s c o - - - - - - - - - - - - ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Mouse messages while down
On Mar 17, 2007, at 9:22 PM, Stephen Barncard wrote: Sorry Joe, polling is just plain bad practice and could interfere with other messaging code. Rev gives plenty of ways to deal with messages that one should never have to use idle. You still have your hypercard hat on. Untie the chains! On 3/17/07 9:54 PM, Joe Lewis Wilkins [EMAIL PROTECTED] wrote: Stephen, So you're saying that with Rev, when the Mouse is Down, other messages can still be sent/received unless a repeat loop of the nature I suggested is invoked, so that it IS polling in the sense that it interrupts the normal flow? I guess things have gotten more complicated than I think they should. Of course, that's mostly because I'm content to do one thing at a time. Guess you could say I'm a stick in the mud! Thank for the observations, nonetheless. The Hypercard way of doing this was to use a repeat loop checking for mouseStillDown... but mouseMove is better since Rev sends this to the card of the topmost stack all the time, unless blocked, even when you are not checking for it. Yep, all the time, but only when the cursor is within a Rev stack window, which makes sense, since it sends the x,y with the message. Now you can have each button receive the messages: mouseEnter mouseLeave which are sent by Rev. Blocking means the buttons will not see them. Malte is an expert at this stuff. Chipp found a bug about a year ago in the mouseLeave sequence with buttons and posted a fix, but I cannot remember the details. Hope this helps you Sarah. Jim Ault Las Vegas ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Mouse messages while down
Sarah Reichelt wrote: I want the user to be able to drag the mouse around Mouse messages while down: SQUEAK! (poor thing) ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution