Discussion in 'Rebol' started by YueM, Feb 27, 2010.

  1. YueM

    YueM New Member

    I am trying to overlay a button on a box in VID. so I was trying the following:

    pan1: layout [ button "hello" ]

    view layout [ z: box 100x200 blue
    z/pane: pan1]

    it doesn't work. it gives me the following:

    ** Script Error: z has no value
    ** Where: do-facets
    ** Near: z/pane: pan1

    can someone let me know why z has no value ?
  2. Graham

    Graham Developer Staff Member

    It's because you are attempting to write Rebol code where you need to write VID which is a dialect.
  3. endo

    endo New Member

    take z/pane: pan1 outside of layout block.
  4. YueM

    YueM New Member

    i am trying to hide a button as soon as I click on it, but it doesn't seem to work . can someone let me know why it is not working ?

    this is the code I am using :-

    view layout [ mbutton: button "hello" [ hide mbutton] ]
  5. Graham

    Graham Developer Staff Member

  6. Graham

    Graham Developer Staff Member

    I'd forgotten the reasons but Steeve says

  7. YueM

    YueM New Member

    Thanks Graham for both the link and the sample code to work around that. I have reworked the script after reading both the link and the code.

    the following seems to work :- view l: layout [ b: button [ hide b unview/all view l]]

    i.e hide then unview then view again

    though I would have preferred it to be what I tried in my original script,

    view layout [ mbutton: button "hello" [ hide mbutton] ]

    which looked more intituitive.
  8. Graham

    Graham Developer Staff Member

    That looks ugly.

    If you don't want to mess around with the feel, then the easiest way is just to shrink it down

  9. YueM

    YueM New Member

    thanks Graham for the tip.

    One thing weird though, I was looking a nick antonaccio's tutorial, the instant messenger tutorial and he has used hide there without any problem. why is his hide working and it doesn't work for me? I have played with his code, if you strip away the lines preceding or following his hide, then his hide doesn't work.

    it looks to me that hide works sometimes , sometimes it doesn't. VID is really frustrating to learn. what is the feedback from other members of the community ?
  10. notchent

    notchent Member

    Hi Yuem :) states that "The face will become visible again the next time the face is shown either directly or indirectly through one of its parent faces.". As Graham quoted above, when you do a button's action, view automatically shows the button's face, which makes it visible again. In the following example, that's why the 2nd button works, but the 1st doesn't:

    view gui: layout [b1: btn "hide" [hide b1] b2: btn "hide" [hide b1]]

    At the link above, the following code is suggested:

    view gui: layout [b1: btn "hide" [remove find gui/pane b1]]

    Notice that no "show" is needed, because the button's action automatically forces a show of the face.

Share This Page