Next: , Previous: , Up: Panels Library   [Contents][Index]


4.13.1 Panels Basics

The panel library can handle the redrawing of your overlapping windows. The window being managed by the panel library is implicitly treated as part of a deck including all other panel windows. The deck is treated as a stack with the top panel being completely visible and the other panels may or may not be obscured according to their positions. So the basic idea is to create a stack of overlapping panels and use panels library to display them correctly. There is a function similar to refresh which, when called , displays panels in the correct order. Functions are provided to hide or show panels, move panels, change its size, etc. The overlapping problem is managed by the panels library during all the calls to these functions.

The general flow of a panel program goes like this:

  1. Create the windows (with newwin) to be attached to the panels.
  2. Convert standard windows to panel windows with the chosen visibility order. Stack them up according to the desired visibility. The function make-panel! is used to create convert a standard window to a panel window.
  3. Call update-panels to write the panels to the virtual screen in correct visibility order. Do a doupdate to show it on the screen.
  4. Manipulate the panels with show-panel, hide-panel, move-panel etc. Make use of helper functions like panel-hidden.
  5. If you ever wish to convert the panel window back into a manually managed window, use del-panel! to delete the panel functionality from the window.
  6. The procedure delwin frees the window.

Note that there is also a shorter way to create and window and convert it to a panel window. The procedure newwin (as well as subwin and derwin take an optional parameter #:panel that, when true, creates the window as a panel window, as in the code snippet below:

(define pwin (newwin 10 10 10 10 #:panel #t))

Let’s make the concepts clear, with some programs. The following is a simple program which creates 3 overlapping panels and shows them on the screen.


Next: , Previous: , Up: Panels Library   [Contents][Index]