linuxconf Howto/FAQ

Howto index

Using passthrough to produce more complex dialogs

The user interface in Linuxconf is limited. The goal is to provide a uniform user interface so that dialogs looks the same everywhere.

The 3 user interfaces concept also limited the feature we can put in a dialog. It is possible to produce a dialog that will take advantage of the GUI. By putting conditional like

    if (dlalog_mode == DIALOG_GUI){
       GUI specific code
    }else{
       html and text
    }

one can produce sharp dialog (or different dialog) in GUI. To achieve this one must have some understanding of the GUI protocol used to talk with the GUI front-end and the layout strategy it is using. All this is described in the following document: http:://www.solucorp.qc.ca/linuxconc/tech/guiapi .

Here is a small example and the screenshot of the resulting dialog. Note the usage of the functions DIALOG::newline() and DIALOG::gui_passthrough().

    DIALOG dia;
    dia.gui_passthrough (P_Group,"g1 "%s"",MSG_U(F_CATEG,"Catégories"));
    for (int i=0; i<4; i++){
        glocal.comb = dia.newf_combo ("",it.categ[i]);
        if (i==0) dia.last_noempty();
        <call sql_query>("select distinct categ%d from todoitems"
             " where project = '%s'"
             " order by categ%d"
             ,i+1,project,i+1);
             <f onerow>
                 glocal.comb->addopt (row[0]);
             </f>
         </call>
         dia.newline();
    }
    dia.gui_passthrough (P_End,"");
    dia.gui_passthrough (P_Groupfit,"g2 "%s"",MSG_U(F_SPECS,"Spécifications"));
    dia.newf_str (MSG_U(F_START,"Démarre"),it.start);
    dia.newline();
    dia.newf_str (MSG_U(F_DONE,"Terminé"),it.done);
    dia.gui_passthrough (P_End,"");
    dia.newline();
    dia.gui_passthrough (P_Form,"f1");
    dia.newf_str (MSG_U(F_TITLE,"Titre"),it.title,70);
    dia.last_noempty();
    dia.newline();
    dia.newf_textarea (MSG_U(F_DESCRIP,"Description"),it.descrip,70,15);
    dia.last_noempty();
    dia.gui_passthrough (P_End,"");
    dia.gui_passthrough (P_Dispolast,"l 2 t 1");
    dia.setbutinfo (MENU_USR1,MSG_U(B_SPELL,"Épellation"),MSG_R(B_SPELL));

Here is the screen shot.