Programming guideline of WinDom
The ''ideale'' windows changes the sliders size and position
depending on their workspace size as the GEM desktop does. With the
GEM desktop example, the number of icons per line displayed in a
window depends on the window width, i.e. the variable xpos_max
depends on the window width. So when the window gets a new size (with
WM_SIZED and WM_FULLED messages) the variable xpos_max must be
refreshed and the function WindSlider() called. That means that the
functions attached to WM_SIZED and WM_FULLED should be customized:
void ideal_szd( WINDOW *win) {
void std_szd( WINDOW *);
win->xpos_max = <new value>;
win->xpos = <new value>;
/* a new value for xpos_max implies a new value for ypos_max */
win->ypos_max = <new value>;
win->ypos = <new value>;
std_szd( win); /* do not invent the wheel ! */
}
without forgeting to attach this function to the window with
something like:
EvntAttach( win, WM_SIZED, ideal_szd);
As you can see, the Windom intern managing of sliders is robust: you
just have to write two functions and use the standard functions. Have
a look at these standard functions std_szd() and std_fld() in the
source code (file STDCODE.C). These functions are quite complex
because they support three kind of situation.