AltME: R3-GUI

Messages

Josh
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
Thank you for the explanation, I will adjust my R2 behavior as well!
Josh
I had always used /text and /data refinements
Josh
Looking at the source for GET-FACE, I don't see any calls to GET-FACET
AREA's facet TEXT-EDIT looks like it just stores the initialization, and the state/caret objects contain run-time data
Josh
Different for text-tables (from previous example)?  
>> get-face tt2
== none
have to use /field refinement
Cyphre
"Looking at the source for GET-FACE, I don't see any calls to GET-FACET" - true, as I metioned above...the internal implemetation of getter/setter interface is not important for app developer. He just needs to know what "fields" the style can get/set etc (will be documented in the new R3GUI docs)
But if you are interested in the GET-FACE internals: the GET-FACE calls ON-GET actor of the style. The style programmer can write the ON-GET (and also simmilarly ON-SET) actor whatewer he wants. So the real internal logic(may include direct access to facets) how the style returns your requested values is inside the actor.
For more info you can read following section in the docs: http://development.saphirion.com/rebol/r3gui/actors/index.shtml#sect8
"Different for text-tables (from previous example)?  
>> get-face tt2
== none
have to use /field refinement"
Yes, that's possible. The behavior of get/set-face is completely in hands of style programmer. Regarding the text-table: maybe the "get-face tt2" default call couls return a block with complete data of the table? Or some other value? You can dicuss this here with Rebolek(author of text-table) and any other R3GUI users.
Josh
I think my first thought would be get-face FACE would return the whole data block

Marco
Speaking of this I'd like to know your opinion about the generic problem of setting/getting a value of a face. Which one of the following methods would you like best?
    face/size: 20x30 show face
    face/set 'size 20x30
    face/resize 20x30
    set-face face 'size 20x30
    resize-face face 20x30
and here are their generic implementations:
    face/set: func [attr value /no-show][
        switch/default attr [
            'size [self/size: value]
            ;...
        ] [set in self attr value]
        unless no-show [show self]
    ]
    face/resize: func [value /no-show][
        do pick [self/set self/set/no-show] none? no-show 'size value
    ]
    set-face: func [face attr value /no-show][
        switch attr [
            'size [do pick [face/resize face/resize/no-show] none? no-show value]
            ;...
        ]
    ]
    resize-face: func [face value /no-show][
        do pick [set-face set-face/no-show] none? no-show 'size value
    ]
Robert
I like this: "face/size: 20x30 show face" but it's not good as you code hard against the widget internal structure. One change and you have to change your code.

Last message posted 262 weeks ago.