No way to prevent clicks on a button
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: No way to prevent clicks on a button
Hi Friends,
Is this where one would use "cancel pendingMessages"?
Mag, it's more than just that line, you can see the full thing in the Dictionary.
Not sure if it's correct, Mark or J-Marc will correct me.
Simon
Is this where one would use "cancel pendingMessages"?
Mag, it's more than just that line, you can see the full thing in the Dictionary.
Not sure if it's correct, Mark or J-Marc will correct me.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
A way to prevent clicks on a button
Hi Simon,
No, pending mouse clicks don't appear in the pendingMessages, but your question is defnitely related. To solve the situation discussed in this thread, I'd probably use the send command. Assuming that there is a group and a circular progress indicator displayed icon in a button, this could work:
This way, any pending mouse clicks are caught by the black image control in group "Black background with progress indicator" before the showEverything handler runs. until that happens, showEverything is in the pendingMessages. On a desktop version of LiveCode, you could use the flushEvents command, but that's unavailable on iOS.
Kind regards,
Mark
No, pending mouse clicks don't appear in the pendingMessages, but your question is defnitely related. To solve the situation discussed in this thread, I'd probably use the send command. Assuming that there is a group and a circular progress indicator displayed icon in a button, this could work:
Code: Select all
on hideEverything
show grp"Black background with progress indicator"
show btn "Progress Indicator"
// do the video recording here
hide btn "Progress Indicator"
send "showEverything" to me in 100 millisecs
// 0 millisecs might work too
end hideEverything
on showEverything
hide grp "Black background with progress indicator"
end showEverything
Kind regards,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: No way to prevent clicks on a button
How about an:
on mouseUp
--do nothing
end mouseUp
in the Black grp/image script?
Would that capture the clicks and dismiss them?
Simon
on mouseUp
--do nothing
end mouseUp
in the Black grp/image script?
Would that capture the clicks and dismiss them?
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: No way to prevent clicks on a button
Hi Simon,
Yes, if you don't want the messages to go up higher in the message hierarchy, then you need mouseUp, mouseDown and mouseDoubleDown handlers, perhaps also mouseMove and other handlers. I'd put them into the image control in this particular case, because the group may not always catch them before the card, if the group has its bgBehavior set to true.
Kind regards,
Mark
Yes, if you don't want the messages to go up higher in the message hierarchy, then you need mouseUp, mouseDown and mouseDoubleDown handlers, perhaps also mouseMove and other handlers. I'd put them into the image control in this particular case, because the group may not always catch them before the card, if the group has its bgBehavior set to true.
Kind regards,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: No way to prevent clicks on a button
Thank you so much friends. Send is a very interesting approach, unfortunately the problem is that I don't know when the AV native control is finished to be created. 

Re: No way to prevent clicks on a button
Hi,
Since in your original solution all mouseUp were collected and fired after the AV control finished, you don't need to know when it finishes. The send command will automatically fire after it finishes. If not, then there was another reason why the mouseUps fired after the AV control finished and you should post your script to let is figure out what you're doing wrong.
Kind regards,
Mark
Since in your original solution all mouseUp were collected and fired after the AV control finished, you don't need to know when it finishes. The send command will automatically fire after it finishes. If not, then there was another reason why the mouseUps fired after the AV control finished and you should post your script to let is figure out what you're doing wrong.
Kind regards,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: A way to prevent clicks on a button
Mark wrote:Code: Select all
on hideEverything show grp"Black background with progress indicator" show btn "Progress Indicator" // do the video recording here hide btn "Progress Indicator" send "showEverything" to me in 100 millisecs // 0 millisecs might work too end hideEverything on showEverything hide grp "Black background with progress indicator" end showEverything
Hi Mark,
Thank you. Well, it works, and this is great... but it works only for the first tap, if you tap two times, the second tap is fired. To avoid the second tap I need to put "1 second" instead of "100 milliseconds", however, this would delay the time at which the user may use the control.
Here is my code:
Code: Select all
on preOpenCard
disableButtons
end preOpenCard
on openCard
createCam
enableButtons
end openCard
on openCard
createCam
send "enableButtons" to this stack in 100 milliseconds
end openCard
on createCam
try
mergAVCamCreate
catch e
-- answer e
end try
end createCam
on enableButtons
hide button "viewCover" of card "main"
end enableButtons
on disableButtons
show button "viewCover" of card "main"
end disableButtons
Re: No way to prevent clicks on a button
Hi,
You have two openCard handlers. Before I answer, could you please edit your post to make sure that it only contains your actual, working code?
Kind regards,
Mark
You have two openCard handlers. Before I answer, could you please edit your post to make sure that it only contains your actual, working code?
Kind regards,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: No way to prevent clicks on a button
Hi Mag,
I'm glad you found a way, but I see two opencard handlers in your script.
Best
Jean-Marc
I'm glad you found a way, but I see two opencard handlers in your script.
Best
Jean-Marc
https://alternatic.ch
Re: No way to prevent clicks on a button
Have a look at 'flushEvents' in the dictionary...
Re: No way to prevent clicks on a button
Dixie,
As I wrote earlier, flushEvents won't work.
Kind regards,
Mark
As I wrote earlier, flushEvents won't work.
Kind regards,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: No way to prevent clicks on a button
Oops, sorry! Here is the right code:
Code: Select all
on preOpenCard
disableButtons
end preOpenCard
on openCard
createCam
send "enableButtons" to this stack in 100 milliseconds
end openCard
on createCam
try
mergAVCamCreate
catch e
-- answer e
end try
end createCam
on closeCard
mergAVCamDelete
end closeCard
on enableButtons
hide button "viewCover" of card "main"
end enableButtons
on disableButtons
show button "viewCover" of card "main"
end disableButtons
Re: No way to prevent clicks on a button
Hi Mag,
It looks like you are using a card for the AV Cam control. I suspect that this card has no buttons and therefore there is no reason to cover anything. Is that right?
You have a closeCard handler, but I wonder what you're using to leave the card? Do you have a button (or a script in any other control or card or stack) to go back to the previous card? When is this button or script available to the user?
You don't need to have a separate card to use the AV cam control, but you can if you want. So tell me, do you want to use the AV Cam control on a separate card without using the cover or do you want to use it on an arbitrary card with the cover?
Could you please change the createCam handler and tell me when you hear the beep?
Do you hear the beep immediately after the AV Cam control appears or after the control disappears?
Kind regards,
Mark
It looks like you are using a card for the AV Cam control. I suspect that this card has no buttons and therefore there is no reason to cover anything. Is that right?
You have a closeCard handler, but I wonder what you're using to leave the card? Do you have a button (or a script in any other control or card or stack) to go back to the previous card? When is this button or script available to the user?
You don't need to have a separate card to use the AV cam control, but you can if you want. So tell me, do you want to use the AV Cam control on a separate card without using the cover or do you want to use it on an arbitrary card with the cover?
Could you please change the createCam handler and tell me when you hear the beep?
Code: Select all
on createCam
try
mergAVCamCreate
catch e
-- answer e
end try
beep
end createCam
Kind regards,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: No way to prevent clicks on a button
Hi Mark,
I have three cards, the Main card contains the AV control and a bunch of buttons (start record, go to preview card, settings and so on); then there is the cards Settings and Preview (where you go to see what you have recorded).
In developer environment (OS X) I see immediately the beep. In iOS beep is not reproduced (if I remember correctly iOS don't play beeps).
I have three cards, the Main card contains the AV control and a bunch of buttons (start record, go to preview card, settings and so on); then there is the cards Settings and Preview (where you go to see what you have recorded).
In developer environment (OS X) I see immediately the beep. In iOS beep is not reproduced (if I remember correctly iOS don't play beeps).
Re: No way to prevent clicks on a button
iOS can be set to beep !