How to Disable the Preference and About Box Items

Richard Gaskin ambassador at fourthworld.com
Fri Dec 2 07:54:44 EST 2005


David Burgun wrote:
>> Since you never wanted to prevent the user from accessing Preferences 
>> anyway, this will get you want you want for the low cost of a couple 
>> milliseconds:
>>
>>   on DisableEditItems
>>     repeat with i = 1 to (the number of lines of btn "Edit"-1)
>>       disable menuitem i of btn "Edit"
>>     end repeat
>>   end DisableEditItems
>>
>> Instant HIG-compliant Edit menu for all supported platforms in one move.
> 
> This causes the Preferences Item in the Apps menu to be un-dimmed but 
> unselectable, or rather nothing happens when you select it. The only way 
> I can see of doing this is to use the above loop but check for an Item 
> starting with "Preferences", which is a tad horrid! Same for the about box.

I'm unable to reproduce that here.

Recipe:

1. Make a new stack
2. Add a menu bar with the default items in Rev's Menu Builder
3. In the Edit menu, for the "Preferences" case I have
         answer "Howdy"
4. Select Preferences from the Edit menu to check it -- ok
5. Added a button with this script:

   on mouseUp
     DisableEditItems
   end mouseUp

   on DisableEditItems
     repeat with i = 1 to (the number of lines of btn "Edit"-1)
       disable menuitem i of btn "Edit"
     end repeat
   end DisableEditItems

6. Click the button
7. Pull down the Edit menu -- yep, items are disabled
8. Select Application->Preferences
    -- I get the answer dialog as expected


What did you do differently?

--
  Richard Gaskin
  Managing Editor, revJournal
  _______________________________________________________
  Rev tips, tutorials and more: http://www.revJournal.com



More information about the use-livecode mailing list