Handling mouseText and mouseline events
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Handling mouseText and mouseline events
Hi everyone,
If in a field containing various lengths of lines of text the mouseText isn't handleable but a mouseLine is, is it possible to handle both of these commands in the same mouseUp event?
My tries so far seem to have shown me that to handle a mouseText event the listBehavior of the field needs to be 'false', and 'true' for the mouseLine command.
In the same mouseUp event I've tried to set the listBehavior with script to be concordant with the relevent mouseText/Line test but with only limited success.
Just wanted to check if what I'm wanting to achieve is possible??
Thanks,
Glenn
If in a field containing various lengths of lines of text the mouseText isn't handleable but a mouseLine is, is it possible to handle both of these commands in the same mouseUp event?
My tries so far seem to have shown me that to handle a mouseText event the listBehavior of the field needs to be 'false', and 'true' for the mouseLine command.
In the same mouseUp event I've tried to set the listBehavior with script to be concordant with the relevent mouseText/Line test but with only limited success.
Just wanted to check if what I'm wanting to achieve is possible??
Thanks,
Glenn
-
- Livecode Opensource Backer
- Posts: 10099
- Joined: Fri Feb 19, 2010 10:17 am
Re: Handling mouseText and mouseline events
All seems fairly straightforward:
-
-
Code: Select all
on mouseUp
put the mouseText into fld "Lclicked"
put the mouseLine into fld "Lnum"
end mouseUp
- Attachments
-
- Line Indicator.livecode.zip
- Here's the stack.
- (1.03 KiB) Downloaded 199 times
-
- Livecode Opensource Backer
- Posts: 10099
- Joined: Fri Feb 19, 2010 10:17 am
Re: Handling mouseText and mouseline events
Changing the line contents to be of varying lengths seems to make no obvious difference.
Re: Handling mouseText and mouseline events
Hi Glenn,
of coursee you can use mousetext and mouseline in ONE mouseup handler.
BUT an open field (locktext = false) does not receive any MOUSEUP or MOUSEDOWN* messages!
*Only a right mousedown to be able to display a context menu or whatever.
Something like this does work:
But NO mouseup handler.
A "mousemove" handler does work however in open fields, no idea if this will help you.
So maybe you need to rethink what and how you are doing what you need to.
Best
Klaus
of coursee you can use mousetext and mouseline in ONE mouseup handler.
BUT an open field (locktext = false) does not receive any MOUSEUP or MOUSEDOWN* messages!
*Only a right mousedown to be able to display a context menu or whatever.
Something like this does work:
Code: Select all
on mousedown tNumber
## Right mousedown
if tNumvber = 3 then
popup btn "some text related menu" at the mouseloc
end if
end mousedown
A "mousemove" handler does work however in open fields, no idea if this will help you.
Code: Select all
on mousemove
put the mousetext & CR & the mouseline
end mousemove
Best
Klaus
Re: Handling mouseText and mouseline events
THIS CALLS FOR A KLUDGE!
If your field is editable, put this in the field script:
Works a treat. Have not tested to see if any special escape routes are a good idea.
The one embedded, "...and the mouseLoc is within..." is VERY necessary.
Craig
If your field is editable, put this in the field script:
Code: Select all
on mouseEnter
interrogate
end mouseEnter
on interrogate
if the mouse is down and the mouseLoc is within the rect of me then answer the mouseLine & return & the mousetext
send "interrogate" to me in 1
end interrogate
The one embedded, "...and the mouseLoc is within..." is VERY necessary.
Craig
Re: Handling mouseText and mouseline events
Dear all,
many thanks for the suggestions, I'll gives these a try and see how it goes...
regards,
Glenn
many thanks for the suggestions, I'll gives these a try and see how it goes...
regards,
Glenn
Re: Handling mouseText and mouseline events
Hi.
Let us know how it goes. My post allows you to click any number of times in the field, each time giving you information. If you want to do this only once, change the handler to:
Craig
Let us know how it goes. My post allows you to click any number of times in the field, each time giving you information. If you want to do this only once, change the handler to:
Code: Select all
on mouseEnter
interrogate
end mouseEnter
on interrogate
if the mouse is down and the mouseLoc is within the rect of me then
answer the mouseLine & return & the mousetext
exit to top
end if
send "interrogate" to me in 1
end interrogate