Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!mips!apple!jdevoto From: jdevoto@Apple.COM (Jeanne A. E. DeVoto) Newsgroups: comp.sys.mac.hypercard Subject: Re: how detect opening of message box? Message-ID: <39149@apple.Apple.COM> Date: 2 Mar 90 23:27:31 GMT References: <1287@ac.dal.ca> Organization: Apple Computer Inc, Cupertino, CA Lines: 42 In article <1287@ac.dal.ca> keith@ac.dal.ca writes: >I'm using the XFCN called controlLock to turn the keytrapping on and off >when the user goes from field to field by either tabbing or mousing. A >problem arises when the user opens the message box and keytrapping is still on. >I don't know how to detect this and turn the keytrapping off automatically. There are two methods you might use. If the only way the user will show the message box is by using the menu item or its command-key equivalent, you can use a doMenu handler to turn off the lock: on doMenu theItem if theItem is "Message" then if the visible of the message is false then -- command to turn off lock else -- command to turn on lock end if end if pass doMenu -- DO NOT UNDER ANY CIRCUMSTANCES FORGET THIS! end doMenu This method raises a problem if the user uses the message windoid's close box to hide it; the keytrapping will not be restored. A way to handle this is to use an idle handler to check the status of the message box: on idle if the visible of the message box is true then -- turn off lock else -- turn on lock end if end idle Idle handlers slow responsiveness in some stacks, but they're sometimes extremely useful. -- ====== jeanne a. e. devoto ======================================== jdevoto@apple.com | You may not distribute this article under a jdevoto@well.UUCP | compilation copyright without my permission. ___________________________________________________________________ Apple Computer and I are not authorized | CI$: 72411,165 to speak for each other. | AppleLink: SQA.TEST