Disabling all controls in stack..
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Disabling all controls in stack..
Hi All,
I'm trying to implement a timeout feature which will disable all of the controls in a specific stack once the time has elapsed.
Is there a way to do this?
I was hoping to just disable the stack and that would also disable my controls but I don't think this is the case.
Thanks!
I'm trying to implement a timeout feature which will disable all of the controls in a specific stack once the time has elapsed.
Is there a way to do this?
I was hoping to just disable the stack and that would also disable my controls but I don't think this is the case.
Thanks!
Re: Disabling all controls in stack..
Hi tasdvl9,
you cannot disable stacks or cards!
You'd need to:
1. loop over all controls in your stack/card and disable them.
Or
2. Simply create a filled graphic, with any blendlevel set, in the size of your card,
that you simply show in your stack on top of all controls
Best
Klaus
you cannot disable stacks or cards!
You'd need to:
1. loop over all controls in your stack/card and disable them.
Or
2. Simply create a filled graphic, with any blendlevel set, in the size of your card,
that you simply show in your stack on top of all controls

Best
Klaus
Re: Disabling all controls in stack..
Hi tasdvl9,
You can of course disable all controls like this:
1. Building a list of all controls of each cd of your stack
2. Launch a loop to disable each control
but display a button transparent at the rect of cd will be easier
Best regards
Jean-Marc
You can of course disable all controls like this:
1. Building a list of all controls of each cd of your stack
2. Launch a loop to disable each control
but display a button transparent at the rect of cd will be easier
Best regards
Jean-Marc
https://alternatic.ch
Re: Disabling all controls in stack..
Thanks, All.
I'll give that a go!
I'll give that a go!
-
- VIP Livecode Opensource Backer
- Posts: 10043
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: Disabling all controls in stack..
An overlay object is a good solution to prevent mouse clicks, but may not prevent keyboard access for any controls whose traversalOn property is set.
To truly disable all controls (and have their appearances updated accordingly) you can group them and then enable/disable the group.
To group them, in the IDE choose Edit->Select All, then Object->Group Selected. You may want to name the group in the Property Inspector.
At runtime, enabling or disabling them is just one line:
...or:
To truly disable all controls (and have their appearances updated accordingly) you can group them and then enable/disable the group.
To group them, in the IDE choose Edit->Select All, then Object->Group Selected. You may want to name the group in the Property Inspector.
At runtime, enabling or disabling them is just one line:
Code: Select all
disable group "MyGroup"
Code: Select all
enable group "MyGroup"
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Disabling all controls in stack..
Hi Richard,
Best
Klaus
ah, yes, good catch!FourthWorld wrote:An overlay object is a good solution to prevent mouse clicks, but may not prevent keyboard access for any controls whose traversalOn property is set.
Best
Klaus
Re: Disabling all controls in stack..
Would it be possible to create a frontScript that trapped all mouse and keyDown events? Just a thought*.
Here is a little experiment you can do. Create a stack and on a card, add two buttons called "answer" and "myFront". Make their scripts look like this:
in the card script write a handler
Test that it works
1. Click on the answer button. A dialog box should appear. Dismiss it.
2. Press Cmd+Shift+a. This will activate the frontScript.
3. Click on the answer button. Nothing happens, proving that frontScript swallows the mouseDown and mouseUp.
4. Press Cmd+Shift+r. This will remove the frontScript.
5. Click on the answer button. A dialog box should appear. Dismiss it.
You could do similar things for keyDown, and other events that you want to trap.
Warning: I am not super familiar with frontScript yet, and it is little tricky. In theory it sounds nice, but in practice it could prove to be more complicated than it appears at first glance. So always experiment in a new stack or if you experiment in an existing stack, make sure to take a copy. Things could lock themselves up and drive you crazy
*The overlay solution is easier and more elegant, and in a real situation I would use it. But to play with and get familiar with frontScript is also good, because you'll never know when you'll need it.
Here is a little experiment you can do. Create a stack and on a card, add two buttons called "answer" and "myFront". Make their scripts look like this:
Code: Select all
-- answer
on mouseUp
answer "How are you?"
end mouseUp
Code: Select all
-- myFront
on mouseUp
put "trapped mouseUp"
end mouseUp
on mouseDown
put "trapped mouseDwn"
end mouseDown
Code: Select all
-- card
on commandKeyDown theKey
if (the shiftKey is down) then
if theKey = "a" then
beep
insert script of button "myFront" into front
else
beep 2
remove the script of btn "myFront" from front
end if
else
pass commandKeyDown theKey
end if
end commandKeyDown
1. Click on the answer button. A dialog box should appear. Dismiss it.
2. Press Cmd+Shift+a. This will activate the frontScript.
3. Click on the answer button. Nothing happens, proving that frontScript swallows the mouseDown and mouseUp.
4. Press Cmd+Shift+r. This will remove the frontScript.
5. Click on the answer button. A dialog box should appear. Dismiss it.
You could do similar things for keyDown, and other events that you want to trap.
Warning: I am not super familiar with frontScript yet, and it is little tricky. In theory it sounds nice, but in practice it could prove to be more complicated than it appears at first glance. So always experiment in a new stack or if you experiment in an existing stack, make sure to take a copy. Things could lock themselves up and drive you crazy

*The overlay solution is easier and more elegant, and in a real situation I would use it. But to play with and get familiar with frontScript is also good, because you'll never know when you'll need it.

uelandbob@gmail.com