send . . . at ?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Livecode Opensource Backer
- Posts: 9375
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
send . . . at ?
The Richmond Fantasy Machine gets into top gear . . .
Is it possible to do this sort of thing in some sort of way?
Pseudocode [possibly]
send "mouseDown" at the mouseLoc
or
send "mouseDown" at 300,300
Is it possible to do this sort of thing in some sort of way?
Pseudocode [possibly]
send "mouseDown" at the mouseLoc
or
send "mouseDown" at 300,300
-
- Livecode Opensource Backer
- Posts: 9375
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: send . . . at ?
OR . . .
is it possible to do this sort of thing?
Pseudocode:
get the short name of the object at 300,300
is it possible to do this sort of thing?
Pseudocode:
get the short name of the object at 300,300
Re: send . . . at ?
Hi Richmond,
real code:
Best
Klaus
real code:
Code: Select all
...
get controlAtLoc((300,300))
## returns -> control (number of control)
put the short name of it
...
Klaus
-
- Livecode Opensource Backer
- Posts: 9375
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: send . . . at ?
Fantastic, Thank you Klaus.
BUT:
a cardScript does not work:
BUT:
a cardScript does not work:
Code: Select all
on mouseUp
put the mouseLoc into ZZZZ
get controlAtLoc((ZZZZ))
put the short name of it into fld "XXX"
end mouseUp
Last edited by richmond62 on Sat May 27, 2023 11:10 am, edited 1 time in total.
-
- VIP Livecode Opensource Backer
- Posts: 261
- Joined: Sat Aug 16, 2008 9:48 am
- Location: Stockholm, Sweden
- Contact:
Re: send . . . at ?
Alternative:
Code: Select all
send "mouseDown" to the mouseControl
Re: send . . . at ?
Just tested and works here!?richmond62 wrote: ↑Sat May 27, 2023 11:04 amFantastic, Thank you Klaus.
BUT:
a cardScript does not work:
Code: Select all
on mouseUp put the mouseLoc into ZZZZ get controlAtLoc((ZZZZ)) put the short name of it into fld "XXX" end mouseUp
Of course you need to click on an existing control!
-
- Livecode Opensource Backer
- Posts: 9375
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: send . . . at ?
It DOES work if the pointer is over a button, but NOT if it is over a card: that throws an error:
- -
And that is predictable because a card is an object, not a control.
What I am looking for a something that will report what is UNDER the mouseLoc regardless of whether it is a control or an object.
AND . . .
objectAtLoc does not exist.
It also does not do much good over a field.
- -
And that is predictable because a card is an object, not a control.
What I am looking for a something that will report what is UNDER the mouseLoc regardless of whether it is a control or an object.
AND . . .
objectAtLoc does not exist.
It also does not do much good over a field.
-
- VIP Livecode Opensource Backer
- Posts: 261
- Joined: Sat Aug 16, 2008 9:48 am
- Location: Stockholm, Sweden
- Contact:
Re: send . . . at ?
Something like this (in the card script)?richmond62 wrote: ↑Sat May 27, 2023 11:26 amWhat I am looking for a something that will report what is UNDER the mouseLoc regardless of whether it is a control or an object.
Code: Select all
on mouseUp
put the mouseControl into tObject
if tObject is empty then put the name of the current card of the mouseStack into tObject
put tObject
pass mouseUp
end mouseUp
on openField
put the mouseControl
pass openField
end openField
-
- Livecode Opensource Backer
- Posts: 9375
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
-
- Livecode Opensource Backer
- Posts: 9375
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: send . . . at ?
So: obviously I have gone wrong somewhere here as my list field is only filling up with something a bit meaningless:
- -
script of button "Detector":
- -
script of button "Detector":
Code: Select all
on mouseUp
put empty into fld "PIX"
put item 1 of the topLeft of this stack into stLR
put item 2 of the topLeft of this stack into stUD
put 280 into UD
set the screenMouseLoc to (300 + stLR), (UD + stUD)
repeat until UD > 320
put the mouseControl into XYZ
if XYZ is empty then
put the name of the current card of the mouseStack after fld "PIX"
else
put XYZ after fld "PIX"
end if
put (":" && 300 & "," & UD && cr) after fld "PIX"
add 1 to UD
set the screenMouseLoc to (300 + stLR), (UD + stUD)
end repeat
end mouseUp
- Attachments
-
- Grabbable Region 2.livecode.zip
- Stack.
- (1.41 KiB) Downloaded 55 times
-
- VIP Livecode Opensource Backer
- Posts: 4000
- Joined: Sun Jan 07, 2007 9:12 pm
- Location: Bochum, Germany
Re: send . . . at ?
Richmond,richmond62 wrote: ↑Sat May 27, 2023 4:01 pmSo: obviously I have gone wrong somewhere here as my list field is only filling up with something a bit meaningless:
this works in your stack for button "Detector" for me. Don't ask me why.
Code: Select all
on mouseUp
put empty into fld "PIX"
put item 1 of the topLeft of this stack into stLR
put item 2 of the topLeft of this stack into stUD
put 280 into UD
set the screenMouseLoc to stLR, stUD -- added
set the screenMouseLoc to (300 + stLR), (UD + stUD)
wait 30 milliseconds with messages -- added
repeat until UD > 320
put the mouseControl into XYZ
if XYZ is empty then
put the name of the current card of the mouseStack after fld "PIX"
else
put XYZ after fld "PIX"
end if
put (":" && 300 & "," & UD && cr) after fld "PIX"
add 1 to UD
set the screenMouseLoc to stLR, stUD -- added
set the screenMouseLoc to (300 + stLR), (UD + stUD)
wait 30 milliseconds with messages -- added
end repeat
end mouseUp
But I still do not understand why you would want to use the screenMouseLoc and why you do not use the mouseLoc and test if it is within the rect of any of the controls of the card.
Kind regards
Bernd
-
- Livecode Opensource Backer
- Posts: 9375
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: send . . . at ?
because mouseLoc was not working.why you would want to use the screenMouseLoc
-
- VIP Livecode Opensource Backer
- Posts: 4000
- Joined: Sun Jan 07, 2007 9:12 pm
- Location: Bochum, Germany
Re: send . . . at ?
Hi Richmond,
What I was asking is why you do not use something like this:
The code I posted earlier did work this morning, but not this evening. It seems to need a special time of the day to work....
However the code I post here is supposed to work at any time of the day.
Kind regards
Bernd
What I was asking is why you do not use something like this:
Code: Select all
on mouseUp
put empty into field "PIX"
put the name of this card into tCdName
repeat with i = the number of controls of this card down to 1
put the rect of control i into tArray[i]
end repeat
put the keys of tArray into tKeys
sort tKeys descending numeric
repeat with y = 280 to 320
put false into tFoundOne
put 300,y into tTestLoc
repeat for each line aKey in tKeys
if tTestLoc is within tArray[aKey] then
put "control" && aKey && tTestLoc & cr after tCollect
put true into tFoundOne
exit repeat
end if
end repeat
if tFoundOne is false then
put tCdName && tTestLoc & cr after tCollect
end if
end repeat
delete char -1 of tCollect -- a return
put tCollect into field "PIX"
end mouseUp
However the code I post here is supposed to work at any time of the day.
Kind regards
Bernd