On 5/8/11 11:37 PM, David Glass 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:
Terry showed a better way to do this. I think he was right about the
problem. MouseMove is sent continually and should be used instead of a
repeat loop; combining the two is probably setting up some kind of
message queue that needs to clear before anything else happens. A repeat
loop locks out all messages until it finishes, and after that the queued
messages are handled. The best way to manage things is to use mousemove
to do all your resizing; it is sent repeatedly so you don't need any
loops. And in between each mousemove message the engine has a chance to
do housekeeping and cleans up the queue.
BTW, you don't need to check "the tool". The scripts won't run unless
the tool is the browse tool; otherwise you're in edit mode.
I have a web page discussing issues with checking the state of the mouse
in a repeat loop, which should be avoided whenever possible:
<http://www.hyperactivesw.com/polling.html>
--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode