Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Temporarily deactivation



On Fri, 18 Mar 2005 20:53:50 +0100, Jasper Van Proeyen
<email@hidden> said:
>Thanks both for your solutions.
>Because I'm not that familiar with other programming languages, I used
>the one from Brad (it works now, btw), but I'm sure that Christopher's
>solution will be more clean.
>It's just one of the drawbacks of AppleScript I guess

No, it has nothing to do with AppleScript. You'd face the same problem using
Cocoa in any language; in fact, you'd face the same problem using any
application framework in any language on any platform. Interface management
is tricky stuff.

One very clean way to perform simple interface management of this type
automatically (enabling or disabling lots of interface widgets at once,
depending on some single condition) is to take advantage of the Cocoa
Controller Layer (also known as bindings). In effect you can perform the
entire mass disablement / enablement with no code at all.

Another approach is to change windows. If the user shouldn't be able to
press any buttons in a window, then hide that window so the user can't get
at it, and show another. Or you can conceal the window without hiding it -
show a sheet, for instance, which disables everything in the window, or show
another window modally. Or just alter the whole content of the window - put
all the interface items the user shouldn't interact with on a tab view, and
change tabs.

m.

>On Mar 18, 2005, at 04:27 PM, Brad wrote:
>
>> Jasper,
>>
>> I use the "tag" property to allow me to quickly enable/disable
>> buttons, fields, etc. Below is a simple example. The button that is
>> attached to the "clicked" handler is setup as a toggle button. It's
>> tag is 0. All of the other buttons in the window have a tag other than
>> 0. This code will enable/disable any button in the window with a tag
>> of 1.
>>
>> on clicked theObject
>>  set theWindow to the window of theObject
>>  if the state of theObject is 1 then
>>   set the enabled of every button of theWindow whose tag is 1 to true
>>  else
>>   set the enabled of every button of theWindow whose tag is 1 to false
>>  end if
>> end clicked
>>
>>
>> Brad
>> -----
>> There are 10 types of people in the world: those who understand binary
>> and those who don't.
>>
>>
>> On Mar 18, 2005, at 12:34 AM, Jasper Van Proeyen wrote:
>>
>>> Hi,
>>>
>>> is there any easy way to temporarily deactivate all buttons in a
>>> window when one of the buttons is clicked.
>>> Note that there already are some buttons disabled.
>>>
>>> Right now I have to ask for the state of every button, disable them
>>> and then call back every state (CPU is not happy with this).
>>>
>>> Regards,
>>> Jasper.
>>>
>>> _______________________________________________
>>> Do not post admin requests to the list. They will be ignored.
>>> Applescript-studio mailing list
>>> (email@hidden)
>>> Help/Unsubscribe/Update your Subscription:
>>> http://lists.apple.com/mailman/options/applescript-studio/
>>> email@hidden
>>>
>>> This email sent to email@hidden
>>>
>>>
>>
>>  _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Applescript-studio mailing list
>> (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/applescript-studio/
>> email@hidden
>>
>> This email sent to email@hidden
>-------------- next part --------------
>A non-text attachment was scrubbed...
>Name: not available
>Type: text/enriched
>Size: 7354 bytes
>Desc: not available
>Url : 
http://lists.apple.com/mailman/private/applescript-studio/attachments/20050318/2
87b59dc/attachment.bin
>
>

-- 
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide
<http://www.amazon.com/exec/obidos/ASIN/0596005571/somethingsbymatt>



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-studio mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-studio/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.