Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

Hide a face inside its action event?

 [1/6] from: greggirwin::mindspring::com at: 14-Jan-2002 15:25


Is it possible to hide a face when you're responding to an action for that face? E.g. clicking a button performs some actions, one of which is to hide the button itself. I can't seem to make it work. Other faces hide just fine, but not the one that is engaged. Example: view layout [button "hide" [hide face]] I'd like to avoide setting flags and having another face responding to time events just to do this, but if I have to... Thanks! --Gregg

 [2/6] from: sterling:rebol at: 14-Jan-2002 15:19


It all depends o nwhen you do the hide. The problem you are running into is that the face is reshown automatically to display the change in the face as you release the mouse button. If you hide it on the 'up event then it should hide just fine. Example: view layout [ button "hide" feel [ engage: func [f a e] [if a = 'up [hide f]] ] ] Sterling

 [3/6] from: greggirwin:mindspring at: 14-Jan-2002 17:09


Hi Sterling, << It all depends o nwhen you do the hide. The problem you are running into is that the face is reshown automatically to display the change in the face as you release the mouse button. If you hide it on the 'up event then it should hide just fine. >> Ahhh. AHA! So, if I hide the face and then set 'show to false, it won't redraw? <work work work> Nope. Things don't re-show correctly after that. Hmmm. Oh well. I guess I'll just write the 'engage for it. Thanks! --Gregg

 [4/6] from: greggirwin:mindspring at: 15-Jan-2002 10:23


Hi Sterling, As an alternate plan, I can move it off-screen to simulate hiding it. Are there any downsides to that approach? --Gregg

 [5/6] from: rotenca:telvia:it at: 16-Jan-2002 0:37


Hi Gregg
> Is it possible to hide a face when you're responding to an action for that > face? E.g. clicking a button performs some actions, one of which is to hide > the button itself. I can't seem to make it work. Other faces hide just fine, > but not the one that is engaged.
look at the standard engage of button: func [face action event][ switch action [ time [if not face/state [face/blinker: not face/blinker]] down [face/state: on] alt-down [face/state: on] up [if face/state [do-face face none] face/state: off] alt-up [if face/state [do-face-alt face none] face/state: off] over [face/state: on] away [face/state: off] ] cue face action show face ;<----------- ] after every engage event, catched or not catched by switch, the face is shown. You hide and engage show! You could do: view layout [button "hide" [hide face] feel [engage: func [face action event][ switch action [ time [if not face/state [face/blinker: not face/blinker]] down [face/state: on] alt-down [face/state: on] up [if face/state [do-face face none] face/state: off] alt-up [if face/state [do-face-alt face none] face/state: off] over [face/state: on ] away [face/state: off] ] cue face action ;show face ;<----------- commented out ]] --- Ciao Romano

 [6/6] from: greggirwin:mindspring at: 15-Jan-2002 23:59


Hi Romano, Thanks! For the moment, I've decided just to move the button off-screen to hide it. Eventually, a new style would be the way to go, and I may use your solution when I head down that path. --Gregg