xform - yesno.c
This commit is contained in:
parent
8a17ec60c5
commit
09a846f9b1
6
.gitignore
vendored
6
.gitignore
vendored
@ -30,9 +30,5 @@ code/plugiciel.so
|
||||
code/appelant
|
||||
code/flydraw.png
|
||||
code/flydraw.gif
|
||||
code/xform/yesyno
|
||||
|
||||
|
||||
A
|
||||
|
||||
D
|
||||
code/flydraw.gif
|
||||
|
12
chap/X11.tex
12
chap/X11.tex
@ -153,7 +153,17 @@ protocol, improved threading support, and extensibility.
|
||||
en C, mais le premier exemple du tutorial d'initiation ne fonctionne
|
||||
pas vraiment comme il devrait. Mais quand même une affaire à suivre.
|
||||
|
||||
\lstinputlisting[language=c]{code/xf_yesno.c}
|
||||
\lstinputlisting[language=c]{code/xform/yesno.c}
|
||||
|
||||
Compilation: \texttt{gcc yesno.c -lforms -o yesno}
|
||||
|
||||
En fait, je ne me souviens plus du petit souci qui m'a fait négliger
|
||||
trop lontemps ce discret toolkit graphique, mais ça avait
|
||||
quelque chose à voir avec
|
||||
la constante \texttt{FL\_BORDER\_BOX} qui
|
||||
\textbf{ne} fait \textbf{pas} le borderbox.
|
||||
|
||||
http://xforms-toolkit.org/examples.html
|
||||
|
||||
%-------------------------------------------------------------------
|
||||
|
||||
|
35
code/xform/yesno.c
Normal file
35
code/xform/yesno.c
Normal file
@ -0,0 +1,35 @@
|
||||
#include <forms.h>
|
||||
/*
|
||||
* gcc yesno.c -lforms -O YESYNO
|
||||
*/
|
||||
int main(int argc, char *argv[]) {
|
||||
FL_FORM *form;
|
||||
FL_OBJECT *yes,
|
||||
*no,
|
||||
*but;
|
||||
|
||||
fl_initialize(&argc, argv, "Yes or No ?", 0, 0);
|
||||
|
||||
form = fl_bgn_form(FL_UP_BOX, 320, 120);
|
||||
fl_add_box(FL_BORDER_BOX, 160, 40, 0, 0, \
|
||||
"Do you want something?");
|
||||
yes = fl_add_button(FL_NORMAL_BUTTON, \
|
||||
40, 70, 80, 30, "Yes");
|
||||
no = fl_add_button(FL_NORMAL_BUTTON, \
|
||||
200, 70, 80, 30, "No");
|
||||
fl_end_form();
|
||||
|
||||
fl_show_form(form, FL_PLACE_MOUSE, FL_TRANSIENT, \
|
||||
"Vroum !");
|
||||
|
||||
while (1) {
|
||||
if (fl_do_forms() == yes) {
|
||||
printf("Yes is pushed\n");
|
||||
break;
|
||||
}
|
||||
else printf(" No is pushed\n");
|
||||
}
|
||||
|
||||
fl_finish();
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user