admtabs.c

This example shows how to use multiple tabs within a dialog.

/*
        Advanved Dialogs v1.0.7 - Example program
        Copyright (C) 2005-2008 Jonas Gehring

        Advanced Dialogs is free software; you can redistribute it and/or modify
        it under the terms of the GNU Lesser General Public License as published by
        the Free Software Foundation; either version 2 of the License, or
        (at your option) any later version.

        Advanced Dialogs is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        GNU Lesser General Public License for more details.

        You should have received a copy of the GNU Lesser General Public License
        along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/


// C Source File
// Created 14.03.2005; 22:27:21


#include <tigcclib.h>                                   // Include all standard header files

#include <extgraph.h>                                   // Include ExtGraph v2.00beta5 by TI-Chess Team
#include <AdvDialogs.h>                                 // Powered by Advanced Dialogs v1.0.7


// Main function
void _main(void)
{
        // Turn on grayscale graphics
        if (!GrayOn())
        {
                return;
        }
                
        ADVDIALOG *dialog = AdvDlgNew(140, 72, "Setup", TRUE);          // Create dialog with title "Setup"
        char inputbuffer[35];
        const char *items[5] = {"Option 1", "Option 2", "Option 3", "Option 4", "Unbelievable Option 5"};
        short itemselect = 0;
        
        memset(inputbuffer, 0, 35);
        
        // Check if the creation was successful
        if (dialog == NULL)
        {
                GrayOff();
                return;
        }
        
        AdvDlgAddTab(dialog, 0, "Info");                        // First tab: "Info"
        
                AdvDlgAddText(dialog, 0, 0, "This is a demonstration of the", TXT_STANDARD, COLOR_BLACK);
                AdvDlgAddText(dialog, 0, 1, "TIGCC Library Advanced Dialogs", TXT_STANDARD, COLOR_BLACK);
                AdvDlgAddText(dialog, 0, 3, "Use [APPS] to switch between the tabs.", TXT_STANDARD, COLOR_BLACK);

        AdvDlgAddTab(dialog, 1, "Personal");            // Second tab: "Personal"

                AdvDlgAddInputBox(dialog, 1, 0, "Your name:", &inputbuffer[0], 19, INPUT_STR, COLOR_BLACK);
                AdvDlgAddInputBox(dialog, 1, 1, "Your age:   ", &inputbuffer[20], 2, INPUT_INT, COLOR_BLACK);
                AdvDlgAddText(dialog, 1, 2, "You cannot log in without your ID!", TXT_CENTERED, COLOR_WHITE);
                AdvDlgAddInputBox(dialog, 1, 3, "Your ID:      ", &inputbuffer[23], 8, INPUT_INT, COLOR_BLACK);

        AdvDlgAddTab(dialog, 2, "Settings");            // Third tab: "Settings"

                AdvDlgAddText(dialog, 2, 0, "Please choose your settings", TXT_STANDARD, COLOR_BLACK);
                AdvDlgAddCheckBox(dialog, 2, 1, "Auto log-in", FALSE, COLOR_BLACK);
                AdvDlgAddCheckBox(dialog, 2, 2, "Save settings", FALSE, COLOR_BLACK);
                AdvDlgAddDropDown(dialog, 2, 3, "Default options:", items, 5, &itemselect, COLOR_BLACK);
                AdvDlgAddCheckBox(dialog, 2, 4, "Use default theme", TRUE, COLOR_BLACK);
                
        AdvDlgAddTab(dialog, 3, "About");                       // Fourth tab: "About"
        
                AdvDlgAddText(dialog, 3, 0, "Advanced Dialogs", TXT_CENTERED, COLOR_BLACK);
                AdvDlgAddText(dialog, 3, 1, "- "ADVDLG_VERSION_STR" -", TXT_CENTERED, COLOR_BLACK);
                AdvDlgAddText(dialog, 3, 3, "visit our website:", TXT_CENTERED, COLOR_BLACK);
                AdvDlgAddText(dialog, 3, 4, "http://www.boolsoft.org", TXT_CENTERED, COLOR_WHITE);
        
        // Finally, we're adding some buttons
        AdvDlgAddButton(dialog, 0, B_OK);
        AdvDlgAddButton(dialog, 1, B_ESC);
        
        // Execute the dialg
        AdvDlgDo(dialog, DUMMY_HANDLER);        
        
        // Free the dialog; you can also simply call "free(dialog)"
        AdvDlgFree(dialog);
        
        GrayOff();
        ClearKbdQueue();
        
        // Final message
        ST_helpMsg("http://www.boolsoft.org");
}


Generated on Wed Nov 5 09:46:56 2008 for Advanced Dialogs by  doxygen 1.5.7.1