-
Notifications
You must be signed in to change notification settings - Fork 11
Properties
Common | Buttons | Fields | Text | Menus | Cards | Stack | Window | WyldCard
A property is a HyperTalk-addressable attribute that determines how an object looks, feels, and reacts to user interaction.
Note that WyldCard treats properties as "first class" containers that can be accessed in whole or by chunk the same way you'd access any other value. HyperCard was not quite so flexible; properties always had to be read using the get
command and written using the set
command.
For example,
set the lockText of field "Not Editable" to true
add 10 to the left of the message box
set the itemDelimiter to "|"
repeat while the mouseLoc is within the rect of me
All WyldCard objects share these properties:
Property | Description |
---|---|
bottom |
Returns or sets the bottom-most border of the part's location, moving the part vertically when changed but not affecting its height. |
bottomRight |
Returns or sets the bottom-right coordinate of the part. When set, this property adjusts the part's position on the card but does not affect its height or width . This property accepts a point value consisting of a comma-separated x and y coordinate, for example, set the bottomRight of me to "10, 100"
|
contents |
Returns or sets the value of this object. For example, set the contents of cd field 1 to "Hello" is equivalent to, put "Hello" into cd field 1 . This property does not exist in HyperCard. |
enabled |
Returns or sets whether the part is enabled. When disabled, the part appears "grayed out". Note that disabled parts continue to receive user interface generated messages such as mouseUp or mouseEnter . May also be set with the enable and disable commands. Not applicable to window, stack, card or background parts. |
height |
Returns or sets the height of the part (in pixels). Read only when applied to part types whose size cannot be changed (like cards and background). |
id |
Returns the part's ID. Each part has a globally unique ID that is assigned by WyldCard at creation and cannot be changed. |
left |
Returns or sets the left-most border of the part's location, moving the part horizontally but not affecting its width. |
location |
Returns or sets the center-point of the part. Also known as loc . |
name |
Returns or sets the script-addressable name of the part (on buttons, this value determines the label or text that appears drawn on the button). |
number |
Returns the number of the part, a value representing its order relative to other parts of the same type. This value is read only. |
rectangle |
Returns or sets the rectangle of the part, equivalent to getting or setting the top , left , height and width properties together. This property only accepts a rectangle value, consisting of two, comma-separated point coordinates representing the top-left and bottom-right positions of the part, for example "10, 10, 100, 100" . This value is also accessible as rect . Read only for parts whose size cannot be changed. |
right |
Returns or sets the right-most border of the part's location, moving the part horizontally but not affecting its width. |
script |
Retrieves or replaces the current script of the part. |
top |
Returns or sets the top-most border of the part's location, moving the part vertically but not affecting its height. |
topLeft |
Returns or sets the top-left coordinate of the part. When set, this property adjusts the part's position on the card but does not affect its height or width . This property only accepts a point value consisting of a comma-separated x and y coordinate, for example, "10, 100"
|
width |
Returns or sets the width of the part (in pixels). Read only when applied to part types whose size cannot be changed (like cards and background). |
In HyperTalk, it's possible to author self-modifying scripts by writing to the script
property. This was common practice in a few stacks that shipped with HyperCard. However, be aware that if you attempt to reuse self-modifying scripts from these old stacks, you'll likely run into bugs introduced by a nuanced difference in the way this property behaves in WyldCard.
In HyperCard, when setting the value of the script
property, the HyperCard script editor would pretty-print the text put into this property. That is, anything put into the script
property might be changed on-the-fly (by HyperCard) so that it appears neatly formatted when viewed in the script editor. In mathematical terms, HyperCard's script
property violates the reflexive property: The value you get
reading the script
property may not equal the value you put
into it.
WyldCard does not modify text put into the script
property. Scripts originally written to account for HyperCard's pretty printing behavior will function poorly inside WyldCard.
In addition to the properties listed above, all button and field parts share these properties:
Property | Description |
---|---|
selectedText |
For fields, returns the currently selected text. For buttons, returns the selected menu item of popup -style buttons or the empty string for all other button styles. This property is read-only; it cannot be set via HyperTalk. |
style |
Sets or retrieves the style of the part (see the tables below for available button and field styles). |
textAlign |
Returns or sets the text alignment of the part; one of left , right or center . Assumes center if any other value is provided. |
textFont |
Returns or sets the font (family) of the part. Uses the system default font if the specified font family does not exist. |
textSize |
Returns or sets the size (in points) of the part's text. |
textStyle |
Returns or sets the text style attributes of the part. Valid style attributes include plain , bold , italic (plus strikeThrough , underline , subscript and superscript when addressing fields). Provide a list to set multiple attributes together (i.e., set the textStyle of me to "bold, italic" ) |
visible |
Returns or sets the visibility of the button (a Boolean value). When invisible, the part is not drawn on the screen and receives no messages from WyldCard. This value can also be accessed using the hide and show commands. |
Buttons come in a variety of styles which define their look-and-feel. WyldCard supports the following button styles:
Style | Name | Notes |
---|---|---|
native |
A push button whose style matches that of the current operating system. | |
classic |
A push button drawn in the style of Mac OS Classic. | |
default |
A Mac OS Classic push button with a heavy outline (this style was used in MacOS Classic to indicate a button that could be selected by pressing enter). | |
round rect |
HyperCard's original push button style; drawn as a round-rectangle with a drop shadow. | |
shadow |
A push button drawn with a drop-shadow decoration. | |
oval |
A push button drawn with an oval border. | |
rectangular |
A push button drawn with a rectangular border. | |
transparent |
A push button drawn without any decoration or border; can be placed atop of graphics on the card to make any region of the card "clickable" | |
opaque |
A rectangular push button drawn without a border. | |
checkbox |
A checkbox drawn in the style provided by the operating system. When autohilite is true and the family property is an integer value, then clicking this button will cause the hilite of all other buttons in the family to become false and the hilite of this button to become true. |
|
radio |
A radio button drawn in the style provided by the operating system. When autohilite is true and the family property is an integer value, then clicking this button will cause the hilite of all other buttons in the family to become false and the hilite of this button to become true. |
|
popup |
A drop-down (combo box) menu drawn in the style provided by the operating system. Each line of the button's contents are rendered as a selectable menu item. |
In addition to the properties common to all parts, a button has these additional unique properties:
Property | Description |
---|---|
autoHilite |
Returns or sets whether the button's hilite property is managed by WyldCard. When autoHilite is true , checkbox and radio buttons automatically check/uncheck when clicked, and other styles of buttons highlight when the mouse is down within their bounds. |
hilite |
Returns or sets whether the button is drawn "highlighted"; for checkbox and radio styles, hilite describes whether the checkbox is checked or the radio button is selected; for other styles, hilite describes a "pressed" state--a highlight typically drawn while the user holds the mouse down over the part. This property has no effect on popup style buttons. |
iconAlign |
Sets the alignment of the icon relative to the button's label (name), one of: left , right , top or bottom (default). Has no effect on buttons that do not have an icon. This property did not exist in HyperCard. |
showName |
Returns or sets the visibility of the button's name (a Boolean value). When false, the button is drawn without a name. |
In WyldCard, fields come in four styles. HyperCard provided a specific style of scrollable text field, but in WyldCard, every style of field is scrollable. (Scrolling can be disabled by setting the scrolling
property to false
.)
Style | Name | Notes |
---|---|---|
rectangle |
An opaque field drawn with a rectangular border (drawn in the style of the operating system). | |
shadow |
An opaque field drawn with a drop-shadow border. | |
opaque |
An opaque field drawn without a border. | |
transparent |
A transparent field drawn without a border. |
A field has these unique properties:
Property | Description |
---|---|
autoSelect |
When true, the field behaves as a list; clicking a line in the field automatically hilites (selects) the entire line of text. |
autoTab |
When true, typing tab in the field causes focus to move to the next focusable UI component; when false, typing tab inserts a tab character into the field contents. |
lockText |
Returns or sets whether the text contained by the field can be edited by the user. |
showLines |
Returns or sets whether dotted baselines are drawn underneath the text (imitates ruled notebook paper) |
dontWrap |
Returns or sets whether text automatically breaks (wraps) at the visible edge of the field. When false, the field will scroll horizontally until a return character is reached. |
multipleLines |
Determines if multiple lines of text can be selected in auto-select mode. That is, whether the list field allows multiple selections or not. Has no effect when the autoSelect property is false . |
scroll |
The number of pixels that have scrolled from the top of the field; 0 indicates that the first line of text is visible at the top of the field. Has no effect if the field is not scrolling. |
scrolling |
Enables or disables vertical scrolling in this field. This property does not exist in Apple's HyperCard. |
sharedText |
When true , each card in the background shares the same text in the field. When false , each card in the background can place a unique value into the field. Has no effect on card fields. |
wideMargins |
Returns or sets whether the field is drawn with a wider, 15-pixel margin between its text and border. |
The properties of text within a field can also be addressed in HyperTalk: A script may get or set the font, size and style of a chunk of text within a field.
Property | Description |
---|---|
textFont |
Returns or sets the font family of the identified chunk of text |
textSize |
Returns or sets the text size of the identified chunk of text |
textStyle |
Returns or sets the style (bold , italic or plain , underline , strikeThrough , superscript or subscript ) of the identified range of text. |
For example,
set the textStyle of the last word of card field "Some Text" to "bold, italic"
add 3 to the textSize of the middle line of field 6
The name, accelerator key (shortcut), disabled state and checkmark of a menu item can be modified in HyperTalk by referring to these properties.
Menu Property | Description |
---|---|
name |
A string value representing the name (text) of the menu item. For example, set the name of menuItem "Italic" of menu "Style" to "Oblique"
|
commandChar |
A single character representing the accelerator key (the command or control-key sequence that can be typed to execute the command). Note that only command/control-key accelerators are supported; you cannot combine with shift or other keys. If more than one character is specified, the first character in the value will be used. |
enabled |
A boolean value representing whether the menu item is enabled (selectable). For example, set the enabled of menuItem "Back" of menu "Go" to false . Also available via the enable and disable commands. |
checkmark |
A boolean value indicating whether the menu has a checkmark next to it. For example, set the checkmark of menuItem "Plain" of menu "Style" to not the checkmark of menuItem "Plain" of menu "Style"
|
Cards and backgrounds are objects in WyldCard that support these unique properties:
Property | Description |
---|---|
marked |
A general-use, logical-valued "flag" indicating that the card is somehow special; useful for classifying or limiting search and sort results. For example, sort the marked cards of this stack ... . (Applies only to cards) |
cantDelete |
A logical value indicating that the card or background cannot be deleted from the stack (without first clearing this flag). When applied to a background, cards in the background may be deleted provided at least one card of the background remains. |
dontSearch |
When true, indicates that fields appearing on this card (or any card sharing this background) will not be searched by the find command. |
showPict |
A logical value specifying if the card or background picture is visible. |
WyldCard stacks support these properties:
Property | Description |
---|---|
cantPeek |
When true, holding command -option will not highlight the outline of buttons and fields, and clicking a highlighted part will not open its script editor. |
resizable |
Indicates or sets whether the card window can be resized to adjust the dimensions of the stack itself. This property does not exist in HyperCard. |
A window is an addressable object in WyldCard and supports these properties (in addition to the properties common to all objects):
Property | Description |
---|---|
zoomed |
Indicates or sets whether the window has been maximized or zoomed (that is, currently displayed in its largest allowable dimensions). |
Some properties apply globally to WyldCard rather than just an individual part. The syntax for setting or getting a global property is similar to part properties. For example:
set the itemDelimiter to ","
get the itemDelimiter
WyldCard supports these global properties:
Global Property | Description |
---|---|
address |
Returns the IP address of the localhost (as defined by Java's Inet4Address.getLocalHost() method), or empty, if the IP address cannot be retrieved. Note that HyperCard's address property returned the Mac's AppleTalk network address. |
brush |
An integer value between 0 and 23 indicating the active paintbrush. |
centered |
A boolean value indicating whether shapes from center out, or corner-to-corner (equivalent to "Draw Centered" in the "Options" menu). |
cursor |
The name of the cursor to be displayed in place of the default, hand cursor; one of ibeam , cross , plus (same as busy ), watch , hand , arrow , busy or none . Does not effect paint tool, button tool or field tool cursors. Resets to hand on idle. Some cursors may not be supported on all operating systems. |
filled |
A boolean value indicating whether shapes are being drawn filled (equivalent to "Draw Filled" in the "Options" menu). |
grid |
A boolean value indicating whether the paint tool grid is enabled. When true , enables an eight pixel grid. |
lockMessages |
When true, the openCard , closeCard and openStack messages will not be sent. Reset to false at idle time. |
lockScreen |
A boolean value indicating whether or not the screen is locked. Reset to false at idle. See the "Visual Effects" section for more details. |
itemDelimiter |
A character or string used to mark the separation between items in a list. WyldCard will use this value anywhere it needs to treat a value as a list. For example, set the itemDelimiter to "***" \n get the second item of "item 1***item 2***item 3" -- yields 'item 2' . Note that this value has no effect on point or rectangle list items (i.e., when getting or setting the rect , topLeft or bottomRight of a part, the coordinates will always be separated by a comma irrespective of the current itemDelimiter ). |
lineSize |
The width, in pixels, of the line/outline drawn by paint tools. |
multiple |
A boolean value indicating whether shapes are being drawn multiple (equivalent to "Draw Multiple" in the "Options" menu). |
pattern |
Gets or sets the number of selected paint pattern. Patterns are numbered 0 to 39. Setting to a value outside this range has no effect. |
polySides |
An integer representing the number of sides drawn using the polygon tool. |
scriptTextFont |
The name of the font family used in the script editor; default is Monaco . |
scriptTextSize |
The size, in points, of the text of the script editor; default is 12 . |
systemVersion |
The read-only version number of the Java Virtual Machine executing WyldCard, for example, 1.8.0_131 . |
textArrows |
When false , pressing an arrow key will always navigate between cards in the stack; when true , pressing an arrow key will only navigate between cards in the stack if a text field is not in focus (when a text field has focus and textArrows is true, the arrow keys move the caret position within the field). |
textFont |
The currently active font family, as indicated by the selection in the "Font" menu. |
textSize |
The currently active font size, as indicated by the selection in the "Style" menu. |
textStyle |
The currently active font style, as indicated by the selection in the "Style" menu. |
theme |
Sets or get the name of the currently active look-and-feel. Use the themes function to determine which themes are available to be used on the current system. This property does not exist in HyperCard. |
As noted in the table above, some of these properties are reset to their default values automatically during idle time (when all script handlers have finished executing).
Copyright © 2019 Matt DeFano, licensed under MIT