I am trying to create a user interface that I saw on a computer display at the Hotel Metropole in Cork, Ireland, on vacation. It was an informational display that had a column of white buttons down the left side of a portrait-oriented monitor. Each button represented a category of information, and when it was clicked, it turned red and another part of the display showed sub-categories of information. The sample script below is an attempt to get that column of white buttons.
The sample below does not work, and I am not even sure if it CAN work no matter what I do. But, looking over the code for the "button" style, I get the impression that it MIGHT work if I only got the right things set. I am wondering if anyone has any thoughts on the matter.
Thank you.
R E B O L [
Title: "Button changer"
]
;; Change all buttons back to the original state of
;; a white button with red text
RESET-ALL: does [
B1/color: white
B1/font/colors: [255.0.0 0.0.0]
show B1
B2/color: white
B2/font/colors: [255.0.0 0.0.0]
show B2
B3/color: white
B3/font/colors: [255.0.0 0.0.0]
show B3
]
;; Debugging display
SHOW-ATTRIBUTES: does [
print ["B1/color: " B1/color]
print ["B2/color: " B2/color]
print ["B3/color: " B3/color]
print "-------------------------"
]
;; The window is a column of white buttons with red text.
;; When a button is clicked, it changes to a red button
;; with white text...AND...any previously-clicked button
;; goes BACK TO being a white button with red text.
;; In other words, only one button can be red at any time.
MAIN-WINDOW: layout [
below
B1: button white 300x60 "BUTTON 1" font [
colors: [255.0.0 0.0.0]
size: 24
] [
RESET-ALL
B1/color: red
B1/font/colors: [255.255.255 0.0.0]
show B1
]
B2: button white 300x60 "BUTTON 2" font [
colors: [255.0.0 0.0.0]
size: 24
] [
RESET-ALL
B2/color: red
B2/font/colors: [255.255.255 0.0.0]
show B2
]
B3: button white 300x60 "BUTTON 3" font [
colors: [255.0.0 0.0.0]
size: 24
] [
RESET-ALL
B3/color: 255.0.0
B3/font/colors: [255.255.255 0.0.0]
show B3
]
button 120 "Probe" [SHOW-ATTRIBUTES]
button 120 "Quit" [quit]
button 120 "Debug" [halt]
]
view center-face MAIN-WINDOW