The window sliders ''Ideal'' windows
Programming guideline of WinDom

How WinDom uses the window sliders

To correctly use sliders, you just need to initialize some variables of the window descriptor. If the size of the displayed data changes over time, you need to update the values of these variables: xpos, xpos_max, ypos, ypos_max, h_u and w_u. Some of them can be used by the window redraw function.

xpos
indicates the horizontal position of data inside the window workspace. This variable is used to compute the position of the horizontal slider,

xpos_max
gives the highest value of xpos. Actually we always have: 0 <= xpos < xpos_max,

ypos and ypos_max
are indentical to xpos and xpos_max but address the vertical slider.

h_u
is the vertical scrolling unit (in pixel) when a vertical line scroll occurs,

w_u
is the horizontal scrolling unit (in pixel) when a horizontal line scroll occurs,

AES uses a values between 0 and 1000 for the slider position and size. WinDom uses a values in the interval [0, xpox_max[ or [0, ypos_max[. Sliders size is automatically computed depending the quantity of data displayed in the window.

Take an example. We want display an ASCII text in a window. In this context, the variable ypos is exactly the index of the first line displayed in the window and the variable xpos is the first column displayed in the window (we suppose we use a non proportional font to display the text). So the variable ypos_max represents the number of lines of the text and the variable xpos_max should the size of the largest line or a fixed number like 255, to have it easyer. The variable h_u represents the height of a character cell and the variable w_u is the width of a character cell. When the window is opened, the variables xpos and ypos should be zero. The following figure picture the situation.


  (0,0)                              xpos_max
     ----------------Text------------------
     |                                    | <- Top of the text.
     |       ======= Window =======       |
     |Hello g|uy.Nice to meet you |<-ypos |
     |       |       _            |       |
     |       |      |c| <- h_u    |       |
     |       |       ^---- w_h    |       |
     |       |                    |       |
     |       ----------------------       |
     | xpos---^                           |
     |                                    |
  .->|                                    | <- Botton of the text
  |  --------------------------------------
 ypos_max

This variables are set when the window is created. Then, the function WindSlider() sets the size and position of the sliders according to the variables previously described. Usually, the function WindSlider() is used when you change the value of a slider variable. In other cases, the event standard function calls WindSlider(). The previous subsection Non proportional window gives a complet example with sliders.