if the optionkey is down then put script of me into bkgnd field lowerpane
set cursor to 2
get the rect of me
BarButton 3,600,0
put the result into bkgnd field results
end mousedown
-- part 2 (button)
-- low flags: 00
-- high flags: 8003
-- rect: left=174 top=296 right=325 bottom=313
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Show Card's script
----- HyperTalk script -----
on mouseUp
put the script of this card into bkgnd field lowerpane
end mouseUp
on mousedown
if the optionkey is down then put script of me into bkgnd field lowerpane
end mousedown
-- part 8 (field)
-- low flags: 80
-- high flags: 0000
-- rect: left=312 top=57 right=142 bottom=512
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 9
-- style flags: 0
-- line height: 12
-- part name:
-- part contents for background part 10
----- text -----
You can issue the "BarButton" command at any time; you're not limited to just when a user clicks in the button. The fourth parameter is used when you wish to force an initial value without requiring that the user click in the button. When you supply this fourth parameter, BarButton displays the initial value and immediately returns, without even looking at the mouse location.
Throughout this stack we have assigned initial values to the Bar buttons in the script of each card, in response to the "opencard" event. You can easily look at an example of this by clicking on the button "Show Card's script". Or you can simulate an opencard event by "blind typing" the "opencard" command.
In some circumstances you may wish to graph initial values using the fourth parameter, but not want the numeric value displayed. A first parameter value less than zero tells BarButton to do this. So instead of using values between 1 and 4, use the corresponding negatives between -1 and -4:
-1: left to right, no numeric display
-2: right to left, no numeric display
-3: bottom to top, no numeric display
-4: top to bottom, no numeric display
The script of the first card in this stack has several examples of this technique.
-- part contents for background part 4
----- text -----
422
-- part contents for card part 8
----- text -----
{BarButton adjusts the size of the bar contained within rect in first 4}