AltME: R3-GUI

Messages

Josh
Dug through r3-gui.r and found this:
do-actor tt2 'on-filter-data [1 [value = 1]]
which seems to work
though I have not the faintest what it is really doing
GrahamC
Ok, so this works then
Rebol [
]
ind: [
    [1 "Jones" "Tom"]
    [2 "Smith" "William"]
    [3 "Jones" "Stephen"]
]
eve: [
    [1 "Arrival" "Wearing a red hat"]
    [1 "Departure" "No hat"]
    [2 "Lunch" "Salmon Sandwich"]
    [1 "Dinner" "Pasta"]
    [2 "Departure" "Red shirt"]
]
view [
    tt1: text-table 600x400 ["ID" #1 70 "Last Name" #2 200 "Given Name" #3 200] ind on-action [
        filter: first pick get-facet face 'table-data arg/y
        do-actor tt2 'on-filter-data compose/deep [1 [value = (filter)]]
        draw-face tt2
    ]
    tt2: text-table 600x400 ["ID" #1 70 "Event" #2 150 "Description" #3 300] eve
]
Cyphre
Josh, Graham, the more "correct" SET-FACE version works as well. You just need to pass map! instead of block! like:
REBOL []
ind: [
    [1 "Jones" "Tom"]
    [2 "Smith"  "William"]
    [3 "Jones" "Stephen"]
]
eve: [
    [1 "Arrival"  "Wearing a red hat"]
    [1 "Departure" "No hat"]
    [2 "Lunch" "Salmon Sandwich"]
    [1 "Dinner" "Pasta"]
    [2 "Departure" "Red shirt"]
]
view [
    tt1: text-table 600x400 ["ID" #1 70 "Last Name" #2 200 "Given Name" #3 200 ] ind on-action [
        filter-value: first pick get-facet face 'table-data arg/y
        set-face/field tt2 make map! compose/deep [
            1 [value = (filter-value)]
        ] 'filter
    ]
    tt2: text-table 600x400 ["ID" #1 70 "Event" #2 150 "Description" #3 300] eve
]
Josh
Cyphre,  Sweet.  That is exactly what I was trying to do.  thank you so much!
Josh
Bug or expected behavior?
REBOL []
load-gui
ind: [
    [1 "Jones" "Tom"]
    [2 "Smith"  "William"]
    [3 "Jones" "Stephen"]
]
view [
    tt1: text-table 600x400 ["ID" #1 70 "Last Name" #2 200 "Given Name" #3 200 ] ind
    tt2: text-table 600x400 ["ID" #1 70 "Event" #2 150 "Description" #3 300] ind
    button on-action [set-face/field tt2 make map! compose/deep [1 [value = "1"]] 'filter]
]  
click the button and look at the red filter drop down on tt2.   There are two <=======> options.  Should there only be one when a filter is in place?
Cyphre
I don't know what does the "<=======>" option mean exactly so let's see if Rebolek can comment on that.
Robert
IIRC (it's been a while that I used it):
do-actor tt2 'on-filter-data [1 [value = 1]]
The [1 [value = 1]] part means:
- filter column 1
- filter by value 1
VALUE is the word that's used by the filter code to compare for TRUE or FALSE
I think it's even possible to filter by more than one column, filtering is applied in order. So first filter, than on the result-set, 2nd filter etc.
Luis
How to programaticaly set drop-down at i.e the second item of data ?
Luis
view[ d: drop-down [ "11" "22" "33"] on-action []button "set drop-down to 2" on-action [set-face d 2]]

Josh
I'm struggling a lot coming from R2 and dealing with faces.   get-facet seems extremely unintuitive to me.  
Let's say I have an area:
view [c: area "hello"] print get-facet c 'text-edit
get-facet always returns "hello" even if I type something else in the area.  What is going on with this?
is there a different facet that stores the "real" information?
Josh
the 'state and 'caret objects have the correct text, but can't find a way to access those
Josh
ah, yes, '
get-face c
making things overcomplicated, I suppose
Josh
I think I assumed that GET-FACE would return a face-object
Cyphre
Josh, this getter function is same as in R2 VID...try:
>> view/new layout [a: area "Hello"]
>> get-face a
== "Hello"
So R3GUI is 'compatible' in that way and R2 VID users should be familiar with that interface already.
Cyphre
But it is true most people are used to directly hack into the style internals in R2 VID. So in R3-GUI we wanted to avoid that and 'force' people to use indirect/abctract mechanisms from the beginning because In the end both sides, the user and the style designer are happy because using the abstracted methods user's code won't break if style internals are changed in future versions.

Last message posted 262 weeks ago.