Page 3 of 4

Re: No way to prevent clicks on a button

Posted: Tue Jun 25, 2013 3:10 pm
by Mag
Dixie wrote:iOS can be set to beep !
Oh, great, I will try right now then.

Edit: OK, I saw this in Dictionary:
Note: The iPhone has no default system alert sound so if a sound is required one must be specified using the beepSound property. The action of beep is controlled by the system and depends on the user's preference settings. In particular a beep will only cause a vibration if the user has enabled that feature. Similarly, a beep will only cause a sound if the phone is not in silent mode.
This I guess means that I I play a sound that I provide the delay will be significant and not as immediate as the beep of a desktop computer... Anyway I will try.

Re: No way to prevent clicks on a button

Posted: Tue Jun 25, 2013 3:14 pm
by Mark
Hi,

It doesn't matter whether you try a beep or an answer dialog or something else you can come up with, as long as you can tell me whether something happens right after executing the mergAVCamCreate control or much later, but I think I'm slowly getting what's going on. Will get back to it later today.

Best,

Mark

Re: No way to prevent clicks on a button

Posted: Tue Jun 25, 2013 3:18 pm
by Mag
Mark wrote:Hi,

It doesn't matter whether you try a beep or an answer dialog or something else you can come up with, as long as you can tell me whether something happens right after executing the mergAVCamCreate control or much later, but I think I'm slowly getting what's going on. Will get back to it later today.

Best,

Mark

Thanks Mark, great, I will try with a put in field command.

Re: No way to prevent clicks on a button

Posted: Tue Jun 25, 2013 3:28 pm
by Mark
Hi,

I think this is what you need:

Code: Select all

on preOpenCard
   // don't do anything, let stack render itself first
   // disableButtons
end preOpenCard

on openCard
   // send createCam message only after LiveCode is ready
   send "createCam" to me in 0 millisecs
   // send "enableButtons" to this stack in 100 milliseconds
end openCard

on createCam
   disableButtons
   put the millisecs into myTimer
   try
      mergAVCamCreate
      catch e
      -- answer e
   end try
   answer (the millisecs - myTimer)
   // sending enableButtons to stack causes execution error
   send "enableButtons" to me in 100 millisecs
end createCam

on enableButtons
   hide button "viewCover" of card "main"
end enableButtons

on disableButtons
   show button "viewCover" of card "main"   
end disableButtons

// this doesn't seem to be relevant for our problem
on closeCard
   mergAVCamDelete
end closeCard
Let me know the time in the answer dialog that appears and whether the answer dialog appears before or after the AV Cam control is visible.

Kind regards,

Mark

Re: No way to prevent clicks on a button

Posted: Tue Jun 25, 2013 3:58 pm
by Mag
At startup about 1127
When returning from another card about 1490

PS
Please note that in an iPod the AV control in this stack takes about 3/4 seconds to create in quality "Standard" (which is the one I use for tests), in quality "High" about 5/6 seconds

Re: No way to prevent clicks on a button

Posted: Tue Jun 25, 2013 5:27 pm
by Mark
Hi,

I expect the script to work now. Let me know.

Best,

Mark

Re: No way to prevent clicks on a button

Posted: Tue Jun 25, 2013 6:13 pm
by Mag
Mark wrote:Hi,

I expect the script to work now. Let me know.

Best,

Mark
Hi Mark,

it works! Well, only for a single tap, if you tap more than one time then you'll get that the button under the cover button fires.

If I don't remove the Asnswer statement all works well.

Re: No way to prevent clicks on a button

Posted: Tue Jun 25, 2013 6:22 pm
by Mark
Hi,

What would the user tap on? On the AV Cam control or something else?

Mark

Re: No way to prevent clicks on a button

Posted: Tue Jun 25, 2013 6:52 pm
by Mag
I tested more on a button (record button) which starts a timer and then performs the video recording. But this is true for all the buttons present in the card (go to settings, go to preview card and so on), some of them has mouseUp handlers, other have mouseDown handlers. Naturally the effects of the pressing of the button starts as soon as the control is created and the cover button is disappeared.

Re: No way to prevent clicks on a button

Posted: Tue Jun 25, 2013 7:06 pm
by Mark
Hi,

What happens if you send the enableButtons message in 10 seconds? Does the 2nd tap still cause the mouseUp handler in the button to run? Do any other scripts in your project run? Do you have any other scripts that run automatically when the stack or card opens?

Kind regards,

Mark

Re: No way to prevent clicks on a button

Posted: Tue Jun 25, 2013 8:46 pm
by Mag
Mark wrote:Hi,

What happens if you send the enableButtons message in 10 seconds? Does the 2nd tap still cause the mouseUp handler in the button to run? Do any other scripts in your project run? Do you have any other scripts that run automatically when the stack or card opens?

Kind regards,

Mark
With 4 or more seconds all works and all taps are ignored.

PS
Currently all the other scripts in openCard and preOpenCard are commented.

Re: No way to prevent clicks on a button

Posted: Tue Jun 25, 2013 11:35 pm
by Mark
Hi,

What is happening here is really weird. For now, I'm out of ideas. I think you should report this problem to Monte. Ask him to update the external, e.g. with a callback message that is sent when the external finishes setting up the control.

Kind regards,

Mark

Re: No way to prevent clicks on a button

Posted: Thu Jun 27, 2013 3:07 pm
by Mag
Thank you Mark, and to all other people that post in this topic. I learned a lot with your posts!

Re: No way to prevent clicks on a button

Posted: Thu Jun 27, 2013 5:30 pm
by FourthWorld
Have you tried using the flushEvents function to prevent the message from getting into the queue?

Re: No way to prevent clicks on a button

Posted: Thu Jun 27, 2013 5:48 pm
by Mark
Richard,

FlushEvents is incompatible with iOS (this thread is in the iOS Deployment forum). This was mentioned two times earlier in this thread.

Mark