Steven White — 14-Apr-2015/19:15:23-7:00
I have decided to quit whining about the VID documentation and produce, for my own benefit, the kind of documentation I would like to see. Easier said that done. Anyway, I listed all the styles using the technique found somewhere, here or on Carl's blog, I forget, and I ran across the items noted in the test script below. Since I have not seen them documented, I am wondering if they are available for a regular person to use, or if they are perhaps internally-used items that are best left alone.
Thank you, whoever knows the answer.
R E B O L [
Title: 'VID test harness'
]
;; Paste code below to test
view layout [
btn-enter
btn-cancel
btn-help
]
Nick — 15-Apr-2015/22:38:42-7:00
I wrote a section about finding built-in help:
http://business-programming.com/business_programming.html#section-13.1
You may find this particularly helpful:
view layout [
text-list data (extract svv/vid-styles 2) [
a/text: select svv/vid-styles value
show a focus a
]
a: area 500x250
]
Learning to find your way around SVV is critical if you want to document all of VID.
Nick — 16-Apr-2015/6:35:22-7:00
One thing which will help when you come across an unfamiliar style (widget), is to compare it's code to that of one with which you're familiar. You can use a diff app along with the script above. Copy and save the code to each style, from the script above, each to a different text file, and then use something like ExamDiff to examine the line-by-line differences. For example, if you save the code for 'btn and 'btn-help, you'll see that there are differences in the default size, text, color, font, and action values, among others (i.e., the default action for 'btn-help is [notify "Help is not available."]). Of course, any of those defaults can be re-set by the normal means (just as you would for any other style):
view layout [
btn-help 60x20 "Help" [alert "No help has been defined yet."]
]
The short answer is that those buttons appear to just be convenience styles which Carl must have considered would be often useful.
Anton Rolls — 16-Apr-2015/9:49:17-7:00
You can see these styles in use in the REQUEST-* functions; have a look at the source of REQUEST-COLOR; you can see BTN-ENTER and BTN-CANCEL in use.
>> ?? request-color
request-color: func [
"Requests a color value."
/color clr /offset xy /local result
][
if none? :color-lay [
color-lay: layout [
across origin 5x4 space 8x2
x: box 80x30 ibevel return
t: field center middle 80 font-size 10 return
pad 8
r: slider 16x278 gray red effect [gradient 0x1 255.0.0 0.0.0] [setc 1 r/data]
g: slider 16x278 gray green effect [gradient 0x1 0.255.0 0.0.0] [setc 2 g/data]
b: slider 16x278 gray blue effect [gradient 0x1 0.0.255 0.0.0] [setc 3 b/data]
return
pad 8 btn-enter "OK" 64 [result: x/color hide-popup]
return
pad 8 btn-cancel "None" escape 64 [hide-popup]
]
]
x/color: either tuple? clr [clr] [0.0.0]
r/data: 1 - (x/color/1 / 255)
g/data: 1 - (x/color/2 / 255)
b/data: 1 - (x/color/3 / 255)
refresh
either offset [inform/offset color-lay xy] [inform color-lay]
result
]
Steven White — 17-Apr-2015/10:58:46-7:00
Thank you all for your help. I have modified the ideas above to make a folder of all the code for all the styles, so I can examine them all. Of course don't really know what I am looking at, but a little time and some experimenting should make things clear(er). Pasted below is my modification of the ideas above to capture the style code.
R E B O L [
Title: "Extract code for all VID styles"
]
;; [---------------------------------------------------------------------------]
;; [ This is a little utility program for extracting the code behind all the ]
;; [ VID styles and writing the code for each style into a text file named ]
;; [ <style-name>.txt. These files then can be examined with a text editor. ]
;; [---------------------------------------------------------------------------]
CODE-FILENAME: none ;; will generate name based on style word (dot-txt)
CODE-DIR: request-dir
if not CODE-DIR [
alert "No folder selected for output"
quit
]
change-dir CODE-DIR
foreach [STYLE-WORD STYLE-CODE] svv/vid-styles [
CODE-FILENAME: copy ""
CODE-FILENAME: to-file rejoin [
to-string STYLE-WORD
".txt"
]
write CODE-FILENAME STYLE-CODE
]
alert ["Code files created in " CODE-DIR]