/* * Radio Groups * ------------ * This program demonstates the use of radiogroups to separate * different groups of radiobuttons. */ #include radiobutton tomato, barbeque; radiobutton cash, credit; void place_order(button b) { printf("Sauce:\n"); if (ischecked(tomato)) printf(" Tomato\n"); if (ischecked(barbeque)) printf(" Barbeque\n"); printf("Payment:\n"); if (ischecked(cash)) printf(" Cash\n"); if (ischecked(credit)) printf(" Credit\n"); exitapp(); } void main(void) { window w; rect r; w = newwindow("Pizza", rect(0,0,200,350), StandardWindow); r = rect(10,10,100,30); newlabel("Sauce:", r, AlignLeft); r.y += 35; tomato = newradiobutton("Tomato", r, NULL); r.y += 35; barbeque = newradiobutton("BBQ", r, NULL); r.y += 35; check(tomato); newradiogroup(); newlabel("Payment:", r, AlignLeft); r.y += 35; cash = newradiobutton("Cash", r, NULL); r.y += 35; credit = newradiobutton("Credit", r, NULL); r.y += 35; check(cash); newbutton("Order Pizza", r, place_order); show(w); mainloop(); }