Path: utzoo!utgpu!watserv1!watmath!att!rutgers!uwm.edu!linac!midway!quads.uchicago.edu!chh9 From: chh9@quads.uchicago.edu (Conrad Halton Halling) Newsgroups: comp.sys.mac.hypercard Subject: Re: Protecting individual cards Message-ID: <1990Aug31.201614.20535@midway.uchicago.edu> Date: 31 Aug 90 20:16:14 GMT References: <988@vm.ucs.UAlberta.CA> Sender: news@midway.uchicago.edu (News Administrator) Organization: University of Chicago Lines: 33 In article <988@vm.ucs.UAlberta.CA> BBOLT@vm.ucs.UAlberta.CA writes: >I have been working on a stack in which I would like to be able to protect >individual cards from being deleted when certain conditions are met, such >as a field containing an entry. If the field is empty, the card can be >Cut or Deleted. If the field contains something, then the card should be >protected. I realize that I can protect the card by clicking the check >box in Card Info, but I want to set this property from a script. The way to solve this problem is to put a doMenu handler into the background script. Assuming the background field has the name "myField", here is a script for you to use: on doMenu menuItem -- put this handler into the background script if menuItem is "Cut Card" or menuItem is "Delete Card" then if fld "myField" is empty then pass doMenu end if else pass doMenu end doMenu This script will not pass doMenu if fld "myField" is not empty; hence, the cut or delete command will not take place. When you use a doMenu handler, it is _essential_ that you put "else pass doMenu" in the last line of the handler. Otherwise, no menu command will work, and you can't do anything. This sort of handler gives you alot of control over what the user can or can't do. -- Conrad Halling chh9@midway.uchicago.edu