Getting into LiveCode for iOS? Ask your questions here.
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
Mag
- VIP Livecode Opensource Backer

- Posts: 802
- Joined: Fri Nov 16, 2012 10:51 pm
Post
by Mag » Thu Jun 20, 2013 4:50 pm
EDIT: I changed the topic title to reflect better the problem
When you need to do some long operations you need to prevent user to continue to click on buttons and start operations.
In this situation I tried to use a blended cover button to put over the card. Unfortunately you can continue to tap and have the script of the buttons activated, because I hide the cover button as soon as the operation is finished. My only solution is to wait some ticks before to hide the cover button?
PS
Also, what is the best way to trap also the taps when you are switching from a card to another? I see that you can tap and the object that receives it it's the one under the finger in the new card, which is not good

Last edited by
Mag on Sun Jun 23, 2013 10:11 am, edited 1 time in total.
-
Mag
- VIP Livecode Opensource Backer

- Posts: 802
- Joined: Fri Nov 16, 2012 10:51 pm
Post
by Mag » Thu Jun 20, 2013 5:05 pm
PS
I also add these commands to the cover button, but the tap continues to go to the buttons below
on mouseUp
answer "mouseUp"
end mouseUp
on mouseDown
answer "mouseDown"
end mouseDown
on touchEnd
answer "touchEnd"
end touchEnd
on touchRelease
answer "touchRelease"
end touchRelease
on touchStart
answer "touchStart"
end touchStart
on touchMove
answer "touchStart"
end touchMove
-
Attachments
-

Last edited by
Mag on Thu Jun 20, 2013 5:08 pm, edited 3 times in total.
-
Mark
- Livecode Opensource Backer

- Posts: 5150
- Joined: Thu Feb 23, 2006 9:24 pm
-
Contact:
Post
by Mark » Thu Jun 20, 2013 5:06 pm
Hi,
What exactly is the reason that you don't want the user to click the button again right after the script finishes?
I often see people disable a button while it is performing a task. One should not do this, because if something goes wrong in the script, the feature can't be accessed any more until the programme is restarted. Instead, you can check if the script is currently running:
Code: Select all
local lBusy
on mouseUp
if lBusy is true then
beep
answer warning "I'm busy. Do you want me to start again?" with "OK" or "Cancel"
if it is "Cancel" then
exit mouseUp
else
put false into lBusy
send "mouseUp" to me in 100 millisecs
end if
end if
put true into lBusy
repeat with x = 1 to 1000000 with messages
if lBusy is false then exit mouseUp
// do something here
wait 0 millisecs with messages
end repeat
put false into lBusy
end mouseUp
This is just an example. You'll have to adjust the script to your own needs.
Kind regards,
Mark
Last edited by
Mark on Thu Jun 20, 2013 5:22 pm, edited 1 time in total.
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
-
Mag
- VIP Livecode Opensource Backer

- Posts: 802
- Joined: Fri Nov 16, 2012 10:51 pm
Post
by Mag » Thu Jun 20, 2013 5:13 pm
Hi Mark, thank you for the interesting code, I will study it!
I have two buttons, one of them goes to the next card and one start to record a video (with mergAV). I need to disable them because mergAV camCreate control need some time to create the control and I don't want people can click on the two buttons while the control is not ready.
I need this to avoid that an user see starting things without learning why (infact the user tap is queued and fire when the control is created some second after the tap)...
-
jmburnod
- VIP Livecode Opensource Backer

- Posts: 2729
- Joined: Sat Dec 22, 2007 5:35 pm
-
Contact:
Post
by jmburnod » Thu Jun 20, 2013 5:16 pm
Hi Mark and Mag
cancel misses in the answer dialog
Code: Select all
answer warning "I'm busy. Do you want me to start again?" with "cancel" or "OK"
Kind regards
Jean-Marc
https://alternatic.ch
-
Mark
- Livecode Opensource Backer

- Posts: 5150
- Joined: Thu Feb 23, 2006 9:24 pm
-
Contact:
Post
by Mark » Thu Jun 20, 2013 5:21 pm
Jean-Marc,
Yeah, you're right. I'll edit the code. I think that "Cancel" should be the default.
Best,
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
-
Mag
- VIP Livecode Opensource Backer

- Posts: 802
- Joined: Fri Nov 16, 2012 10:51 pm
Post
by Mag » Thu Jun 20, 2013 5:28 pm
So I have 6 buttons, I have to put in 6 buttons a check to know if the app is busy to do something else before to execute the scripts?
-
Mag
- VIP Livecode Opensource Backer

- Posts: 802
- Joined: Fri Nov 16, 2012 10:51 pm
Post
by Mag » Thu Jun 20, 2013 5:47 pm
Disabling the buttons don't work because when I restore them, they intercept the event that is queued while the app was busy.
What I really need is to trap the user events like mouseDown while the creation of the native control is made.
-
Mark
- Livecode Opensource Backer

- Posts: 5150
- Joined: Thu Feb 23, 2006 9:24 pm
-
Contact:
Post
by Mark » Thu Jun 20, 2013 6:50 pm
Hi,
What about displaying a black screen on top of everything else with a white circular progress indicator until the recording video object appears?
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
-
Mag
- VIP Livecode Opensource Backer

- Posts: 802
- Joined: Fri Nov 16, 2012 10:51 pm
Post
by Mag » Thu Jun 20, 2013 7:36 pm
Hi Mark, seems interesting, do you mean to go to another stack until the work is finished?
-
Mark
- Livecode Opensource Backer

- Posts: 5150
- Joined: Thu Feb 23, 2006 9:24 pm
-
Contact:
Post
by Mark » Thu Jun 20, 2013 10:46 pm
Hi,
No, another stack makes things more complicated on iOS. Just show a group with a black rectangle as large as the card the progress indicator, covering everything else. Hide it when the recording control has appeared or when the user stops recording, whichever is easier or looks better.
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
-
jmburnod
- VIP Livecode Opensource Backer

- Posts: 2729
- Joined: Sat Dec 22, 2007 5:35 pm
-
Contact:
Post
by jmburnod » Thu Jun 20, 2013 10:50 pm
Yes, just a curtain
https://alternatic.ch
-
Mark
- Livecode Opensource Backer

- Posts: 5150
- Joined: Thu Feb 23, 2006 9:24 pm
-
Contact:
Post
by Mark » Thu Jun 20, 2013 10:58 pm
Right.
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
-
Mag
- VIP Livecode Opensource Backer

- Posts: 802
- Joined: Fri Nov 16, 2012 10:51 pm
Post
by Mag » Fri Jun 21, 2013 12:12 am
Thanks, this is exactly what I'm searching to do. The problem is that the mouse event (e.g. mouseUp) is performed by LiveCode at the end of the creation of the control, not when it takes place. At that time there is not any curtain...
So I guess i have to find a way to learn when the control is ready and remove the curtain only some time after that. Currently the remove curtain statement is just after the create control one:
Code: Select all
show curtain
create control
hide curtain
-
Mag
- VIP Livecode Opensource Backer

- Posts: 802
- Joined: Fri Nov 16, 2012 10:51 pm
Post
by Mag » Sun Jun 23, 2013 9:44 am
SUMMARY
When LiveCode is engaged in an intensive task it collects user clicks and it delivers them to the targets when the task is ended.
So, in this situation, there is no way to prevent an user clicks on a button.