World: r3wp
[View] discuss view related issues
older newer | first last |
Louis 19-Oct-2006 [5860] | Sunanda, it has been submitted to rambo. Thanks again! |
Graham 19-Oct-2006 [5861x2] | when working with Vid data structures .. it makes sense to me to perhaps to create functions that act on a vid widget to be associated with that widget |
So, if you have a complex large program, you can keep all the functions that act upon/with a widget's data all in one place. | |
Maxim 20-Oct-2006 [5863] | do you mean like creating a style and specifiying the with block? view layout [ style button button with [ print-lbl: func [][print self/text] ] button "do" [face/print-lbl] ] |
Anton 20-Oct-2006 [5864] | (don't need the "self/" by the way). |
Maxim 20-Oct-2006 [5865x2] | I know it was just to make it explicit. |
;-) | |
Anton 20-Oct-2006 [5867] | ok |
Graham 20-Oct-2006 [5868x4] | Yes. |
and no. | |
Your example uses a style ... | |
You might have multiple functions that operate on the widget and you want to hide them as a type of context inside the widget | |
Maxim 20-Oct-2006 [5872] | you don't need to make a style for the with block. I just did this cause I thought you meant that you want the functions to be applied to a broad set of gadgets. this works directly: view layout [ button "do" [face/print-lbl] with [ print-lbl: func [][print self/text] ] ] |
Graham 20-Oct-2006 [5873] | Hmm. Interesting. |
Maxim 20-Oct-2006 [5874] | funny you didn't know about this after so many years of using REBOL ! |
Graham 20-Oct-2006 [5875] | are these functions exposed to the global context? |
Maxim 20-Oct-2006 [5876] | nope. |
Graham 20-Oct-2006 [5877x2] | well.. I'm not too familiar with vid |
Just know enough to get along .. most of the time! | |
Maxim 20-Oct-2006 [5879x2] | basically the with block is like when you supply a block to something like make face! [] |
or more specifically the call to make-face/spec | |
Graham 20-Oct-2006 [5881] | so, without the with they become anonymous functions |
Henrik 20-Oct-2006 [5882] | If the 'with isn't there, it would just be considered the alt-action block for the button. |
Graham 20-Oct-2006 [5883] | does Glayout use the same syntax ? |
Maxim 20-Oct-2006 [5884x8] | yes, I am a slavemaster to VID. |
I harness VID and let it layout like it should. ;-) | |
you could almost say I abuse it ;-) hehe | |
right now I am plugging liquid directly within. yet another layer of abuse... but it works. | |
actually, liquid is currently so tight, its trying to update the gadget before its even displayed... | |
cause it receives an event during the init. | |
is there a sure-fired way to know if a face is currently shown? I don't remember from the top of my head... anyone? | |
would checking for none? parent-face be sufficient? | |
Graham 20-Oct-2006 [5892] | viewed? |
Maxim 20-Oct-2006 [5893x2] | I don't see that as being a word within the face. could it be show? |
I mean, could it be the attribute: 'face/show? | |
Graham 20-Oct-2006 [5895] | >> help viewed? USAGE: VIEWED? face DESCRIPTION: Returns TRUE if face is displayed. VIEWED? is a function value. ARGUMENTS: face -- (Type: object) |
Maxim 20-Oct-2006 [5896] | ahhh... sourcing viewed? and then find-window, I can say that it all relies on parent-face being set... just what I tought... |
Anton 20-Oct-2006 [5897] | Maxim, you will need to check face/show? for this face and every parent up to the window. Then... umm... you might have to check the window differently, see if it it's in the screen-face/pane. |
Maxim 20-Oct-2006 [5898x2] | so face/show? becomes true once its been shown at least once? |
yes, find-window will tell me if the panes/window its in is currently opened. | |
Anton 20-Oct-2006 [5900x3] | Yes. Hiding can be done with: face/show?: false show face/parent-face |
Ah.. but you will basically need to make a function similar to find-window in order to be sure everything's ok. | |
Yes, you will need to check if parent-face is none. face/parent-face is only set the first time a face is shown. | |
Maxim 20-Oct-2006 [5903] | yeah... but it never gets cleared... that's one of my pet peeves about view/face. |
Anton 20-Oct-2006 [5904] | So you want to redraw a face, while respecting its show? facet, I suppose. |
Maxim 20-Oct-2006 [5905x4] | its hard to get JIT information on real state of faces. |
I want to make sure that I don't try to call show on a face before its been initialised... | |
currently checking parent-face seems to work fine. | |
btw, GLayout sets parent-face in advance... allowing child face the chance to take decisions based on their parent... before the layout is done. | |
Anton 20-Oct-2006 [5909] | The user who rips a face out of a face hierarchy will have to be sure to also set the parent-face to none. |
older newer | first last |