Extended types for objects Extended types and ressource editor Special text objects
Programming guideline of WinDom

Programming thumb indexes

WinDom provides extended objects to create multiple formular (ONGLET), AND a function to handle automatically these objects (see FormThumb() manuel which contains an example).

( 3: A multiple formular with thumb indexes)


WinDom doesnot handle more than one multiple formulars per window dialog box. In these case, you have to handle explicitly.

It is really easy to handle that. We provide the algorithm. First of all, the algorithm provided supposes severals hypothesis :

  1. Thumb index are placed under or upper the formulars. Only a single line of thumb index is possible.

  2. Thumb index have to touch the formulars frames.

  3. Thumb index are G_BUTTON with an extended type 16 and a RADIO flag. Formulars are G_BUTTON with an extended type 16 and are not RADIO.

  4. The index of Thumb object have to ... Les index des boutons d'onglets doivent se suivre.

  5. The formulars have to have the HIDDEN flag.

Constrains 1, 2 and 3 come from the way the objects (ONGLET) are drawn. Constrains 4 and 5 come from the algorithm used. The principle is very simple: the active formular is displayed and the others are hidden using the HIDDEN flag.


(!U)Example(!u)

/* Handle a multiple formular */

void formONGLET( WINDOW *win) {
     static int show = FORM1;   /* formular currently displayed */
     int bckgrd[] = {FORM1, FORM2, FORM3 /*, etc ...*/};
					/* Describes links between thumb index and
			         * formular */
     int res = evnt.buff[4];

     switch( res) {
     /* The multiple formular handling is here */
     case INDEX1:
     case INDEX2:
     case INDEX3:
     /* ... */
		  /* Test if the choice is already displayed */
          if( show == bckgrd[res-BUT1]) break;
          /* Hide the current form */
          FORM(win)[show].ob_flags |= HIDETREE;
		  /* Unhide the new form */
          FORM(win)[bckgrd[res-BUT1]].ob_flags &= ~HIDETREE;
          /* keep in memory the form displayed */
          show = bckgrd[res-BUT1];
           /* this instruction fixes a bug from WinDom */
          ((W_FORM*)win->data)->edit = -1;
          /* Display the new form and the thumb index selected */
          ObjcDraw( OC_FORM, wglb.appfront, show, MAX_DEPTH);
          ObjcDraw( OC_FORM, wglb.appfront, res, 0);
          break;

     /* Others objects ... */
     case OK:
          ...
     }

}