Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://www.atnf.csiro.au/computing/software/gipsy/pguide/gui-example9a.html
Дата изменения: Unknown Дата индексирования: Sat Jan 17 05:42:27 2009 Кодировка: Поисковые слова: р р р р п п п п п п п п п п |
The also exists a similar pop-up, created by
GgiPlotPrompter(),
which allows the user, besides of specifying a file name, to
choose an available PGPLOT hardcopy device.
Example program:
/* example9.c -XT */ #include "stddef.h" #include "gipsyc.h" #include "cmain.h" #include "init.h" #include "finis.h" #include "userfio.h" #include "ggi.h" /* * Button keyword handler for quitting. */ static void quit(ident id, char *key, int code, void *arg) { bool button=toflog(FALSE); (void)userflog(&button, 1, 2, key, " "); if (tobool(button)) { wkeyf(key); /* reset button */ if (GgiVerify("Really quit?", "Yes, quit", "No, continue")) { finis_c(); } } } /* * Button keyword handler creating the "file name" prompter. */ static void promptuser(ident id, char *key, int code, void *arg) { bool button=toflog(FALSE); (void)userflog(&button, 1, 2, key, " "); if (tobool(button)) { GgiPrompter("FILENAME=", "Enter file name:"); /* create prompter */ wkeyf(key); /* reset button */ } } /* * Keyword handler receiving the resulting "file name". */ static void getresult(ident id, char *key, int code, void *arg) { static bool confirmed=FALSE; fint nread; fchar text; char ctext[128]; text.a = ctext; text.l = 127; nread = userftext(text, 2, key, " "); ctext[nread] = '\0'; if (nread) { if (strncmp(ctext, "exist", 4 )) { GgiPrompter("ACCEPT", NULL); /* accept "non-existing" filename */ confirmed = FALSE; } else if (!confirmed) { GgiPrompter("AGAIN", "OK to overwrite?"); /* ask user confirmation */ confirmed = TRUE; } else { GgiPrompter("ACCEPT", NULL); /* accept after confirmation */ confirmed = FALSE; } } else { confirmed = FALSE; /* user pressed "CANCEL" */ } } MAIN_PROGRAM_ENTRY { ident button, quitbtn; init_c(); GgiAutoLayout(FALSE); GgiPostponeRealize(TRUE); button = GgiButton("FILE=", "File name entry"); quitbtn = GgiButton("QUIT=", "Terminate program"); GgiSetPosition(button, 0, NULL, 0, NULL); GgiSetPosition(quitbtn, 0, button, 0, NULL); GgiRealize(); (void)ScheduleKeyevent(promptuser, "FILE=", KEYCHANGE, NULL); (void)ScheduleKeyevent(quit, "QUIT=", KEYCHANGE, NULL); (void)ScheduleKeyevent(getresult, "FILENAME=" , KEYCHANGE, NULL); MainLoop(); }
Maintained by J. P. Terlouw |