#include <stdio.h>
#include "graphapp.h"
Control *name, *phone;
void place_order(Control *b)
{
printf("Name = %s\n", get_control_text(name));
printf("Phone = %s\n", get_control_text(phone));
exit(0);
}
int main(int argc, char *argv[])
{
App *app;
Window *w;
Rect r;
app = new_app(argc, argv);
w = new_window(app, rect(0,0,400,180), "Pizza", STANDARD_WINDOW);
r = rect(10,10,60,25);
new_label(w, r, "Name:", ALIGN_RIGHT); r.y += 30;
new_label(w, r, "Phone:", ALIGN_RIGHT); r.y += 30;
r = rect(80,10,150,25);
name = new_field(w, r, "Type your name here"); r.y += 30;
phone = new_field(w, r, NULL); r.y += 30;
new_button(w, rect(50,80,100,30), "Order Pizza", place_order);
show_window(w);
main_loop(app);
return 0;
}
Notes: