Home THE HYPERCARD CENTER

HyperTalk Reference
Home » HyperTalk Reference » Properties

Note: This is a work in progress and will be formatting errors. Read more about the project on the home page.

enabled

 set [the] enabled of{menu|menuItem }¬
    to trueOrFalse
set [the] enabled of button ¬ to trueOrFalse

The enabled property returns or sets whether a menu item, menu, or button is active or inactive (dimmed). Users cannot choose dimmed elements.

If you set the enabled of a menu to false, all items on the menu become inactive.

The enabled property won't enable items in HyperCard’s menus unless they're currently available to the user.

For example, the following code won't enable the Button Info command unless a button is selected:

set the enabled of menuItem 1 of ¬ menu "Objects" to true
The default state is true, meaning that the element is enabled.


Examples

set the enabled of menu "File" to true
set the enabled of menu 2 to false
set the enabled of second menu to true

set the enabled of menuItem "New" of menu "File" to false
set the enabled of menuItem 2 of menu 2 to true
set the enabled of second menuItem of second menu to false

set the enabled of button 5 to false
if the enabled of bg btn "Scores" is true then show field "Players"

Demo Script

on mouseUp
   if there is a menu "Reference"
   then set enabled of menuItem 4 of menu "Reference" to ¬
        not (enabled of menuItem 4 of menu "Reference")
 end mouseUp

Placeholders

menu
An expression that evaluates to one of the following:

menu text
menu posInteger
ordinal menu
For example:

menu "File"
menu 2
second menu


menuItem
An expression that evaluates to one of the following:

menuItem text
menuItem posInteger
ordinal menuItem
For example:

menuItem "New"
menuItem 2
second menuItem


trueOrFalse
Any expression that evaluates to the HyperTalk and AppleScript constants true or false.

For example:

true
false
the hilite of bg btn "Yes"
fld "Zip" contains "95014"
the short name of this stack is "Fred"


button
HyperTalk DefinitionAn expression that identifies a button by name, number, or id, using one of the following forms:

[card] button id posInteger [of card ][card] button text [of card ] -- name[card] button posInteger [of card ]ordinal [card] button [of card ]

bkgnd
button id posInteger [of card ]bkgnd button text [of card ] -- namebkgnd button posInteger [of card ]ordinal bkgnd button [of card ]For example:

card button id 3894
card button "Return"
card button 1
first card button
bkgnd button 2 of card 2
last bkgnd button
When used inside a button script:
me
When a button receives a message:
[the] target
A button can also be referred to as a part when you’re talking about its position among all buttons and fields within the same card or background.

AppleScript DefinitionAn expression that identifies a button by name, number, or id, using the same forms as HyperTalk except that “background” must be used in place of “bkgnd”.

Related Topics

« editBkgnd | HyperTalk Reference | environment »


Version 0.7b1 (March 24, 2022)

Made with Macintosh

Switch to Modern View

Home
The HyperCard Center
HyperTalk Reference
Home » HyperTalk Reference » Properties

Note: This is a work in progress and will be formatting errors. Read more about the project on the home page.

enabled

 set [the] enabled of{menu|menuItem }¬
    to trueOrFalse
set [the] enabled of button ¬ to trueOrFalse

The enabled property returns or sets whether a menu item, menu, or button is active or inactive (dimmed). Users cannot choose dimmed elements.

If you set the enabled of a menu to false, all items on the menu become inactive.

The enabled property won't enable items in HyperCard’s menus unless they're currently available to the user.

For example, the following code won't enable the Button Info command unless a button is selected:

set the enabled of menuItem 1 of ¬ menu "Objects" to true
The default state is true, meaning that the element is enabled.


Examples

set the enabled of menu "File" to true
set the enabled of menu 2 to false
set the enabled of second menu to true

set the enabled of menuItem "New" of menu "File" to false
set the enabled of menuItem 2 of menu 2 to true
set the enabled of second menuItem of second menu to false

set the enabled of button 5 to false
if the enabled of bg btn "Scores" is true then show field "Players"

Demo Script

on mouseUp
   if there is a menu "Reference"
   then set enabled of menuItem 4 of menu "Reference" to ¬
        not (enabled of menuItem 4 of menu "Reference")
 end mouseUp

Placeholders

menu
An expression that evaluates to one of the following:

menu text
menu posInteger
ordinal menu
For example:

menu "File"
menu 2
second menu


menuItem
An expression that evaluates to one of the following:

menuItem text
menuItem posInteger
ordinal menuItem
For example:

menuItem "New"
menuItem 2
second menuItem


trueOrFalse
Any expression that evaluates to the HyperTalk and AppleScript constants true or false.

For example:

true
false
the hilite of bg btn "Yes"
fld "Zip" contains "95014"
the short name of this stack is "Fred"


button
HyperTalk DefinitionAn expression that identifies a button by name, number, or id, using one of the following forms:

[card] button id posInteger [of card ][card] button text [of card ] -- name[card] button posInteger [of card ]ordinal [card] button [of card ]

bkgnd
button id posInteger [of card ]bkgnd button text [of card ] -- namebkgnd button posInteger [of card ]ordinal bkgnd button [of card ]For example:

card button id 3894
card button "Return"
card button 1
first card button
bkgnd button 2 of card 2
last bkgnd button
When used inside a button script:
me
When a button receives a message:
[the] target
A button can also be referred to as a part when you’re talking about its position among all buttons and fields within the same card or background.

AppleScript DefinitionAn expression that identifies a button by name, number, or id, using the same forms as HyperTalk except that “background” must be used in place of “bkgnd”.

Related Topics

« editBkgnd | HyperTalk Reference | environment »

Version 0.7b1 (March 24, 2022)

Made with Macintosh

Switch to Retro View