root/functions/set-values.r

Revision 114, 1.4 kB (checked in by ashley, 4 weeks ago)

Added /no-show refinement to set-values.r, updated pill.r and fixed face-iterator in widgets.r

Line 
1set-values: make function! [
2        "Puts values into input widgets within a display or grouping widget."
3        face [object!] "Display face"
4        blk [block!] "Block of values (or 'skip)"
5        /no-show "Don't show"
6        /local val
7] [
8        all [
9                find [scroll-panel tab-panel] face/type
10                face: either block? face/pane [face: face/pane/1] [face/pane]
11        ]
12        foreach widget face/pane [
13                if find [
14                        area check check-group drop-list edit-list field group-box password radio-group scroll-panel slider tab-panel table text-list
15                ] widget/type [
16                        unless 'skip = val: first blk [
17                                switch/default widget/type [
18                                        check                   [widget/data: val]
19                                        check-group             [all [block? val insert clear widget/data val]]
20                                        group-box               [all [block? val set-values/no-show widget copy/deep val]]
21                                        radio-group             [widget/select-item to integer! val]
22                                        scroll-panel    [all [block? val set-values/no-show widget copy/deep val]]
23                                        slider                  [widget/data: to decimal! val]
24                                        tab-panel               [all [block? val set-values/no-show widget copy/deep val]]
25                                        table                   [widget/select-row val]
26                                        text-list               [widget/select-row val]
27                                ][
28                                        ;       area drop-list edit-list field password
29                                        widget/line-list: none
30                                        insert clear widget/text val
31                                        all [widget/type = 'area widget/para widget/para/scroll: 0x0 widget/pane/data: 0]
32                                ]
33                        ]
34                        if tail? blk [gui-error "set-values had insufficient values"]
35                        blk: next blk
36                ]
37        ]
38        blk: head blk
39        unless no-show [show face]
40]
Note: See TracBrowser for help on using the browser.