Enabling a Menu

Jim Ault JimAultWins at yahoo.com
Sun Mar 25 12:19:43 EDT 2007


On 3/25/07 7:50 AM, "Joe Lewis Wilkins" <pepetoo at Cox.Net> wrote:

> Mark(s)!
> 
> As always, there are a variety of ways to do things, but you've got
> to get the syntax "exactly" right. My bone to pick with this is that
> my first attempt, which didn't work, didn't get caught by the script
> editor when I did as I usually do, hit the enter key twice, to close
> it. In most cases it picks up any errors the with the first one, but
> when I used enable, which didn't work later, it didn't. Hmn.
> 
The difficulty with the script editor warning you is that in your original
script you *did* do something legal, you did set something... just not what
you wanted.

Because of custom properties, you can
set the jasper of button 1 to true
set the reverseEngines of button 1 to false
set the setToStun of button 1 to "some enchanted evening"

set the inabled of button 1 to true  --OK
set the enalbed of button 1 to true --OK

which stores data in the named custom properties, and is not an error.  The
script editor will have no way of knowing, thus misspelling properties of
any object will not produce a warning.

Not a bug, but a powerful feature that has a downside.

on mouseup
   add 1 to the clickCount of me
end mouseup
 --would tally the users click count in the same button.  You could make
this a property of all the buttons and then do the following...

repeat with x = 1 to the number of controls
    if word 1 of the name of control x is "button" then
        add the clickCount of control x to sumUserClicks
   end if
end repeat
put "User activity = " & sumUserClicks

Jim Ault
Las Vegas 






More information about the use-livecode mailing list