Task

Create a window that has:

   a label that says   "There have been no clicks yet" 
   a button that says   "click me"


Upon clicking the button with the mouse, the label should change and show the number of times the button has been clicked.




#include "button.i"
 
window, 0;
btn_click = Button(text="click me", x=.395, y=.65, dx=0.04368, dy=0.0091);
btn_quit = Button(text="quit", x=.395, y=.6, dx=0.02184, dy=0.0091);
count = 0;
msg = "There have been no clicks yet";
finished = 0;
do {
    fma;
    plt, msg, .395, .7, justify="CH";
    button_plot, btn_click;
    button_plot, btn_quit;
    xy = mouse(0, 0, "");
    if(button_test(btn_click, xy(1), xy(2))) {
        count++;
        msg = swrite(format="Number of clicks: %d", count);
    } else if(button_test(btn_quit, xy(1), xy(2))) {
        finished = 1;
        winkill, 0;
    }
} while(!finished);