A dialog is created as usual and an InputBox is added to it. After the user accepted the dialog, the input string is displayed using a MessageBox.
00001 /* 00002 Advanved Dialogs v1.05 - Example program 00003 Copyright (C) 2005-2007 Jonas Gehring 00004 00005 Advanced Dialogs is free software; you can redistribute it and/or modify 00006 it under the terms of the GNU Lesser General Public License as published by 00007 the Free Software Foundation; either version 2 of the License, or 00008 (at your option) any later version. 00009 00010 Advanced Dialogs is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU Lesser General Public License for more details. 00014 00015 You should have received a copy of the GNU Lesser General Public License 00016 along with this program. If not, see <http://www.gnu.org/licenses/>. 00017 */ 00018 00019 00020 // C Source File 00021 // Created 14.03.2005; 22:27:21 00022 00023 00024 #include <tigcclib.h> // Include all standard header files 00025 00026 #include "extgraph.h" // Include ExtGraph v2.00beta5 by TI-Chess Team 00027 #include "AdvDialogs.h" // Powered by Advanced Dialogs v1.05 00028 00029 00030 // Main Function 00031 void _main(void) 00032 { 00033 LCD_BUFFER *screen; 00034 ADVDIALOG *dialog; 00035 char name[20]; // Name input 00036 char msg[35]; 00037 00038 // Allocate space for the LCD buffer 00039 if (((screen = malloc(sizeof(LCD_BUFFER))) == NULL)) 00040 { 00041 return; 00042 } 00043 00044 LCD_save(screen); // Save LCD contents 00045 00046 if (!GrayOn()) // Turn on grayscale graphics 00047 { 00048 free(screen); 00049 return; 00050 } 00051 00052 memcpy(GrayGetPlane(LIGHT_PLANE), screen, sizeof(LCD_BUFFER)); 00053 memcpy(GrayGetPlane(DARK_PLANE), screen, sizeof(LCD_BUFFER)); 00054 00055 // Reset input 00056 name[0] = 0; 00057 00058 // Create dialog 00059 dialog = AdvDlgNew(140, 55, "Advanced Dialogs", TRUE); 00060 00061 // Add elements 00062 AdvDlgAddText(dialog, 0, 0, "Please enter your name", TXT_STANDARD, COLOR_BLACK); 00063 AdvDlgAddInputBox(dialog, 0, 1, "Your name:", name, 19, INPUT_STR, COLOR_BLACK); 00064 AdvDlgAddText(dialog, 0, 3, "(press [ESC] to quit)", TXT_STANDARD, COLOR_WHITE); 00065 00066 // Add Buttons 00067 AdvDlgAddButton(dialog, 0, B_ESC); 00068 AdvDlgAddButton(dialog, 1, B_OK); 00069 00070 // Execute Dialog 00071 if (AdvDlgDo(dialog, DUMMY_HANDLER)) 00072 { 00073 ClearKbdQueue(); 00074 00075 sprintf(msg, "Welcome %s!", name); 00076 00077 AdvDlgMessageBox("Advanced Dialogs", msg, COLOR_BLACK, B_OK, DUMMY_HANDLER); // Show MessageBox 00078 } 00079 00080 // Free the dialog 00081 AdvDlgFree(dialog); 00082 00083 // Restore contents 00084 ClearGrayScreen(); 00085 GrayOff(); 00086 LCD_restore(screen); 00087 free(screen); 00088 ST_helpMsg("http://www.boolsoft.org"); 00089 } 00090