NEW
  AUTO 3,1
#include <stdio.h>
#include <stdlib.h>
#include <libtui.h>

#define EV_SAVE     192
#define EV_OK       193
#define EV_CANCEL   194

short int LBoxVar;
short int CBoxVar;
short int RadioVar;

int main(int argc, char *argv[])
    {
    short int hCTX = tuiInit();
    short int hSCRN = tuiNewScrn(hCTX, F_bTitle+F_bStatus);
    tuiSetProp(hSCRN, P_pTitle, "Screen Title");
    tuiSetProp(hSCRN, P_pStatus, "Status bar");

    char *pBuf = malloc(1024); 
    pBuf[0]=0;
    short int hTBOX = tuiNewTBox(hSCRN, 1, 1, 44, 20, F_bTitle+F_bStatus+F_bHBorder+F_bVBorder+F_bEdit, pBuf, 1024);
    tuiSetProp(hTBOX, P_pTitle, "Text Box Title");
    tuiSetProp(hTBOX, P_pStatus, "Text Box Status");

    tuiNewLBox(hSCRN, 50, 1, 20, 9, F_bHBorder+F_bVBorder,
        "Item 1\r"
        "Item 2\r"
        "Item 3\r"
        "Item 4\r"
        "Item 5\r"
        "Item 6 very long line\r"
        "Item 7\r"
        "Item 8\r"
        "Item 9\r"
        "Item 10\r"
        "Item 11\r"
        "Item 12\r"
        "Item 13\r"
        "Item 14 last one",
        &LBoxVar);

    char LineBuf[65];
    LineBuf[0]=0;
    tuiNewLabel(hSCRN, 50, 11, "This is a label.");
    tuiNewTLine(hSCRN, 50, 12, 25, &LineBuf, 65); 
 
    tuiNewRadio(hSCRN, 50, 14, 0, 0, 
        "\e[91mRed\r"
        "\e[92mGreen\r"
        "\e[96mBlue",
        &RadioVar);

    tuiNewCBox(hSCRN, 50, 18, 0, 0, "Check Me", &CBoxVar);
    tuiNewBut(hSCRN, 50, 20, 19, EV_SAVE, "(^S)ave...");
    tuiNewBut(hSCRN, 65, 20, 17, EV_QUIT, "(^Q)uit");

    tuiDraw(hSCRN);
    tuiActivate(hTBOX);
    short int e;
    do {
        e = tuiExec(hSCRN);
        if (e == EV_SAVE) {
            short int hDLGS = tuiNewDlg(hSCRN, 70, 11, "Save As...");
            short int hOKBut = tuiNewBut(hDLGS, 50, 7, 13, EV_OK, " OK ");
            short int hCanBut = tuiNewBut(hDLGS, 57, 7, 3, EV_CANCEL, "Cancel");
            tuiDraw(hDLGS);
            tuiActivate(hOKBut);
            short int e;
			do {
				e = tuiExec(hDLGS);
				} while (e != EV_CANCEL);
            tuiDestroy(hDLGS);
            tuiDraw(hSCRN);     
            }
        } while (e != EV_QUIT);


    tuiDestroy(hSCRN);
    tuiClose(hCTX);
    }
MAN
TEXT root/ctest/testlib.c
