AltME: R3-GUI

Messages

Cyphre
I don't think so or at least I don't know about anyone who picket that up so far. But its a critical one so I believe it will be fixed very soon.
=picked

Josh
I have a couple questions about how to deal with actors and I think an example will illustrate it best.
Trying to modify use click actions on a text-table to affect filtering on another text-table:
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-focus [
        print face/name
    ]
    tt2: text-table 600x400 ["ID" #1 70 "Event" #2 150 "Description" #3 300] eve
]
My goal is when i click on tt1 that the ID number on that row will set the filtering on tt2 to show only events with that ID #
Question 1:   on-focus only deals with the first click on that whole face, so it's the wrong actor.  Do i need to modify the actor of an individual row? or am I just using the wrong actor?  If I change on-focus to on-click it results in no print statements.
Question 2:  I'm unsure how to set the filter for tt2.  If I try (stole this code from probing the facet):
        tt2/facet/filter: make map! [
            1 [value = 1]
        ]
it says I cannot access the facet
Josh
Question 2 Revised:   what is the proper form for
set-face/field tt2 "1" filters
GrahamC
Perhaps it's something like
do-actor tt2 'on-filter-data  [undocumented filter dialect ]
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
; set the filter on the table here
draw-face tt2
]
In the Saphirion docs, there is this docs\specs\styles\text-table but it's not very helpful
Josh
On the r3-gui changelog I found Under 10-Mar-2012:  
TEXT-TABLE: Can set filters using [set-face/field table filters]
Yeah, i've been reading and re-reading that
GrahamC
Well, have to ask Rebolek .. he wrote the text-table
reading the docs, I would have thought
get-facet face 'row
would work too but that returns none for me
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

Last message posted 13 weeks ago.