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

VID, layout, DO, init, hide, show === ISSUE + BYPASS THE ISSUE

 [1/6] from: rebol:meurrens at: 26-May-2003 17:45


Hello, You known perhaps that there is a DO functionnality that can be used in a layout definition. As far as I know (???) this functionnality is not documented except in Olivier Auverlot's book and on the page http://www.codeconscious.com/rebol/view-notes.html It seems that the function is called BEFORE showing all the faces of your layout. Thus if you want to decide, within a DO block, which faces you want to show or to hide, depending upon your data, you have a problem !!! All faces will, later on, be shown. Even, for instance, buttons providing an unavailable functionnality, etc. :-( Everything, including an easy way (but somewhat tricky...) to bypass the issue, is explained by running the small script below (just cut & paste in your editor and REBOL it.) HTH It may be a nice feature to have a set of similar functionnalities for doing something at the different steps of the life of the layout (such as just before showing, just after showing, when closed, etc...) May be somebody here may have another solution such as capturing some events, etc ??? I already found on the web how to capture the closing of the window. But, may be there is a general and smart solution somewhere ??? </marc> ;;;;;;;;;;;;;;;;;;;;;;;; ====================================== REBOL [] bad: [ banner 100x50 "Issue" yes-1: button 200x30 "Yes, I must be here" [ unview ] no-1: button red 200x30 "No, I may not be here" [ unview ] area 400x300 { bad: [ banner 100x50 "Issue" yes-1: button 200x30 "Yes, I must be here" [ unview ] no-1: button red 200x30 "No, I may not be here" [ unview ] area 400x300 { ... } do [ hide no-1 ;;;; will show up !!! ] ] } do [ hide no-1 ;;;; will show up !!! ] ] good: [ banner 100x50 "Bypass" yes-2: button 200x30 "Yes, I must be here" [ unview ] no-2: button red 200x30 "No, I may not be here" [ unview ] area 400x300 { good: [ banner 100x50 "Issue" yes-2: button 200x30 "Yes, I must be here" [ unview ] no-2: button red 200x30 "No, I may not be here" [ unview ] area 400x300 { ... } rate 00:00:00 feel [ engage: function [ f a e ][] [ f/rate: none show f ;;;;;;;;;;; DO NOT FORGET TO UPDATE THE rate !!!! hide no-2 ;;;; will NOT show up !!! ] ] ] } rate 00:00:00 feel [ engage: function [ f a e ][] [ f/rate: none show f hide no-2 ;;;; will NOT show up !!! ] ] ] view layout [ banner "VID issue and bypass" button 100x40 red bold 12 "issue" [ view/new/offset layout bad 50x50 ] button 100x40 green bold 12 "bypass" [ view/new/offset layout good 50x50 ] ] ;;;;;;;;;;; =============================================== Prof. Ir Marc Meurrens, Brussels (be) TEL: +32 (0)2 537 2812 FAX: +32 (0)2 537 7645 EMAIL: [marc--meurrens--org] URL: http://www.meurrens.org/ REB: http://rebol.mksa.net/ PGPKEY: http://www.meurrens.org/pgp/ Please don't mail me attached files, instead, use my 'exchange area' : EXCHANGE AREA: http://www.meurrens.org/exchange/ (HTTP/FTP upload/download of temporary/persistent files)

 [2/6] from: jvargas::whywire::net at: 26-May-2003 14:30


Hi Marc: I access the show? attribute of the face to control what will be displayed before the layout is rendered. For example: lay: layout [ f1: button "This will be displayed" f2: button "This will not" f3: button "This will show f2" [show f2] f4: button "This hides f2" [hide f2] ] f2/show?: false view lay Hope this helps. Cheers, Jaime On Monday, May 26, 2003, at 11:45 AM, Marc Meurrens wrote:

 [3/6] from: greggirwin:mindspring at: 26-May-2003 13:49


Hi Marc and Jaime, You could also do this: view layout [ f1: button "displayed" f2: button "not displayed" with [show?: false] f3: button "show f2" [show f2] f4: button "hide f2" [hide f2] ] WITH can be quite handy for this kind of initialization. -- Gregg

 [4/6] from: gchiu:compkarori at: 27-May-2003 14:54


On Mon, 26 May 2003 17:45:36 +0200 Marc Meurrens <[rebol--meurrens--org]> wrote:
>You known perhaps that there is a DO functionnality >that can be used in a layout definition. >As far as I know (???) >this functionnality is not documented except in Olivier >Auverlot's book
Actually Marc, it is documented in http://www.rebol.com/view/docs/view-guide.html But to get that document, you have to load the View desktop, go to rebol.com icon, and then "create doc" to build that page locally. So, I guess that's why you missed seeing that documentation. -- Graham Chiu http://www.compkarori.com/cerebrus/ Rebol anti-spam tool

 [5/6] from: rebol:meurrens at: 27-May-2003 10:21


Hi, Thanks Jaime & Gregg. I didn' t know the existence of the show? attribute for faces. Is it documented somewhere??? I did not find it in the view-guide.. Any URL ??? Seems to have strange properties demonstrated by this small script that you may run on your REBOL/VIEW machine More info on show? ??? Regards, </marc> ============================================ REBOL [] ;;; mm-id-stuff.r view layout [ backcolor snow text {bg: button with [show?: false ttt: "blabla" ]} bg: button green 500x30 {bg: button with [show?: false ttt: "blabla" ]} with [show?: false ttt: "blabla" ] button khaki 500x30 "alert bg/ttt bg/ttt: to-string now ;;; display & update ttt" [ alert bg/ttt bg/ttt: to-string now ] button olive 500x30 "alert to-string bg/show? ;;; display current status" [ alert to-string bg/show? ] button rebolor 500x30 "show bg ;;; the normal way" [ show bg ] button red 500x30 "hide bg ;;; the normal way" [ hide bg ] button blue 500x30 "bg/show?: true ;;; (1) " [ bg/show?: true ] text "(1) The green button will only really show up on mouse over..." text "PLEASE, MOVE NOW YOUR MOUSE TO THE POSITION OF THE GREEN BUTTON" button orange 500x30 "bg/show?: false ;;; (2) (3) " [ bg/show?: false ] text "(2) IF GREEN WAS ALREADY HIDDEN, no effect ..." text "(3) IF GREEN WAS SHOWN, no effect, but then the normal hide will not work..." text " until the button is properly reinitiated by a show in the normal way" button black 500x30 "unview" [ unview ] ] ==================================== Prof. Ir Marc Meurrens, Brussels (be) TEL: +32 (0)2 537 2812 FAX: +32 (0)2 537 7645 EMAIL: [marc--meurrens--org] URL: http://www.meurrens.org/ REB: http://rebol.mksa.net/ PGPKEY: http://www.meurrens.org/pgp/ Please don't mail me attached files, instead, use my 'exchange area' : EXCHANGE AREA: http://www.meurrens.org/exchange/ (HTTP/FTP upload/download of temporary/persistent files)

 [6/6] from: nitsch-lists:netcologne at: 27-May-2003 15:09


Marc Meurrens wrote:
> Hi, > Thanks Jaime & Gregg.
<<quoted lines omitted: 5>>
> that you may run on your REBOL/VIEW machine > More info on show? ???
[REBOL [ Comment: { Hi Marc, Some other ways to do the hiding stuff and a bit explanation. Why does changing /show? not work in your demo? Changing face-facets is deferred until the face is redrawn. that happens when you move the mouse over the button, or when you call 'show on the face. You discovered the post-view-processing trick based on rate. Another way to do it is shown below. system/view/screen-face/pane holds all windows, if we have exactly one after view/new there is only ours, so we start the event-loop ('view makes a similar decision). But instead of hiding unused buttons, i prefer to gray it. see the "inactive" -toggle. (for effects try "rebol/demos/effect-lab" from the rebtop) } Author: "Volker" ] ;print "console.." ; for debugging immediate.. lay: layout [ text "the demo-button" tx: button "click me" [alert "click"] text "do stuff with it" across check [either face/data [show tx] [hide tx]] text "show" return check true [either face/data [ tx/pane: none ] [ tx/pane: make-face/size/spec 'image tx/size [ effect: [merge blur cross] ] ] show tx ] text "active" below button "quit" #"^q" [quit] ] view/new center-face lay wait 0.01 ;process initial events, window open etc. hide tx ;now this works if 1 = length? system/view/screen-face/pane [do-events] ]

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted