AltME: R3-GUI

Messages

GrahamC
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.
Henrik
Cyphre, does that explain this:
"get-facet always returns "hello" even if I type something else in the area."
Cyphre
sure, the get-facet is not a 'public api'..it shouldn't be used by application code
get-facet function is for style programmer
Why it shouldn't be used by app programmer? Because it is used to access internal values (facets) of the style (ie. direct access)
Why style programmer should use it instead of direct access like face/facets/value? If you look at the source of the function it does other checks as well so it will behave always correctly in all cases. Also if internal structure of the face is changed the style code doesn't need to be modified.
This is  just my POV how R3GUI should work. As you can see we don't have the code modularized yet so app programmer cannot see which fuction is 'public'. Also the styles are still using the face/facet/value construct frequently but this can be hopefully changed as well.
Josh
Cyphhre, hehe, I never used get--face in R2 vid

Last message posted 172 weeks ago.