Friday, 1 February 2013

Using VID panel

I noticed that a lot of Rebol users don't know that VID panel face exist. It's a very useful widget to order all items of our windows. It creates a subpanel where arrange items, I think that the following example i more useful than words:


Here is the source code:
Rebol []
view layout [
    title "Example"
    across
    panel blue [
        text "Blue panel"
        button "1"
        button "2"
        button "3"
        ]
    panel red [
        text "Red panel"
        button "1"
        button "2"
        button "3"
        ]
    panel orange [
        text "Orange panel"
        button "1"
        button "2"
        button "3"
        ]  
    return  
    panel green [
        text "Green panel"
        across
        button "1"
        button "2"
        button "3"
        ]
    ]

Please notice that panel has the same size contained layout. So you can use panels without modification of your window size!
You can use panel to create great changing subpanels, see this example:




Here is the source:

Rebol []
view layout [
    title "Example"
    across
    panel [
        button "Version A" [            
            myp/pane: layout/tight [text "Version A" button button button]
            show myp
        ]
        button "Version B" [
            myp/pane: layout/tight [text "Version B" btn btn btn]
            show myp
            ]
        ]      
    myp: panel   100x120 []
    ]


Remember to use layout/tight, otherwise you'll not see well the new layout of a panel.
The second important point to remember about panels is that they don't auto-resize.
Panels, like box, can be change their aspect with edge, with, feel: you can obtain extraordinary effects!

Another great feature of panel is to change all contained fields and areas at glance with th set-face function:




Rebol []
view layout [
    title "Example"
    across
    button "Fill fileds" [          
            set-face myp ["test" "test2" "test3"   "test4"]      
        ]      
    myp: panel   [
        field
        field
        field
        area
        ]
    ]


P.S. I await an answer for the question: http://rebol.informe.com/forum/rebol-2-f8/bcc-in-email-using-send-t22.html
There is a poll on: http://rebol.informe.com/forum/polls-f10/what-theme-do-you-prefer-for-the-portal-t23.html

2 comments:

  1. Is it possible to make a scrolling panel, so that you can have in a panel more buttons than will fit the visible area, but all buttons available through scrolling?

    ReplyDelete
    Replies
    1. Yes, you can. I'll show the special function needed in the next topic.

      Delete