Mouse clicks and cursor change lost after certain actions

Terry Judd tsj at unimelb.edu.au
Mon May 9 00:51:06 EDT 2011


Hi David - Maybe something to do with using a repeat loop within the
mouseMove handler. Here's a script for a split pane (horizonal split)
display out of a stack of mine that does something similar (ignore the
internal details of the mouseDown handler) and uses a flag to track the
status of the mouse rather than a repeat loop.

HTH,

Terry...


local pDown, pYoffset

on mouseEnter
   lock cursor
   set the cursor to 8113
end mouseEnter

on mouseLeave
   put false into pDown
   unlock cursor
end mouseLeave

on mouseDown
   put true into pDown
   put the mouseV -(the top of me) into pYoffset
end mouseDown

on mouseUp
   put false into pDown
end mouseUp

on mouseRelease
   put false into pDown
end mouseRelease

on mouseMove x,y
   if pDown then
      lock screen
      set the top of me to min(540,max(y-pYoffset,203))
      set the top of grp "messageDetails" to the bottom of me -2
      put the rect of fld "message" into tRect
      put 701 into item 4 of tRect
      set the rect of fld "message" to tRect
      put the rect of grp "announcements_DG" into tRect
      put the top of me +1 into item 4 of tRect
      set the rect of grp "announcements_DG" to tRect
      unlock screen
   end if
end mouseMove



On 09/05/2011 02:37 PM, "David Glass" <dglass at graymattercomputing.com>
wrote:

> That subject is pretty bad, but I don't know how else to describe the
> issue. :oops:
> 
> I have a multi-paned interface with one horizontal splitter, and one
> vertical splitter. The code for the horizontal splitter looks like this:
> 
> -------------------------
>      on mouseenter
>         if the tool is "browse tool" then
>            lock cursor
>            set the cursor to 64
>         end if
> 
>      end mouseenter
> 
>      on mouseleave
>         if the tool is "browse tool" then
>            unlock cursor
>         end if
> 
>      end mouseleave
> 
>      on mousemove
>         if the tool is "browse tool" then
>            repeat until the mouse is up
>               if item 2 of the mouseloc > 196 and item 2 of the mouseloc
> < 584 then
>                  set the loc of me to item 1 of the loc of me, item 2 of
> the mouseloc
>                  --rect = left, top, right, bottom
>                  --adjust the stuff above the splitter
>                  set the rect of group "DataGrid 2" to the left of group
> "DataGrid 2", the top of group "DataGrid 2", the right of group
> "DataGrid 2", the top of me
>                  --adjust the stuff below the splitter
>                  set the rect of group "DataGrid 3" to the left of group
> "DataGrid 3", the bottom of me, the right of group "DataGrid 3", the
> bottom of group "DataGrid 3"
>               end if
> 
>            end repeat
>         end if
> 
>      end mousemove
> 
> -------------------------------
> 
> This works as expected, and the code for the vertical splitter is the
> same (with obvious changes for resizing the vertical instead of the
> horizontal).
> 
> The problem is that after doing any resizing -- so the stuff in
> 'mousemove' has finished, and the cursor has been unlocked (mouseleave)
> -- the mouse stops behaving:
> 
> 1. the cursor will not change if I move the mouse into the splitter
> control (mouseenter)
> 1.1 clicking anywhere in the card/window 'wakes' the cursor up, and the
> mouseenter code will then fire when appropriate.
> 
> 2. the first click is swallowed by...something. I haven't figured out
> where it goes. It doesn't matter where I click, the click doesn't seem
> to register.
> 2.1. I can click on the Edit button, and I am not released from Browse
> mode until I click the Edit button a second time.
> 2.2. If I try to click on the code editor hiding behind the active card,
> it does not come to the front until I click it again.
> 
> Interestingly, if I ignore that the cursor hasn't visibly changed, and
> drag the splitter around, it does move (and the cursor changes when the
> splitter first starts to move), and then when I release the mouse button
> the cursor behaves properly so I can immediately put the cursor in the
> splitter and the cursor changes. Until I do it again, and then I'm back
> to the behavior above. So it almost works out to 'every other time it's
> right.' :?
> 
> This description isn't much better than the subject, but I'm not sure
> how else to describe the behavior I'm seeing.

--
Dr Terry Judd | Senior Lecturer in Medical Education
Medical Education Unit
Melbourne Medical School
The University of Melbourne







More information about the use-livecode mailing list