Simple windowed application: Difference between revisions

adding Yorick
(adding Yorick)
Line 1,353:
Reg_Set(10, " times", APPEND)
}</lang>
 
=={{header|Yorick}}==
Yorick does not include a GUI toolkit. However, it does provide a plotting system that can emulate some basic GUI features, such as buttons and labels. The above sample uses a built-in library "button.i", which is itself written in Yorick.
 
<lang yorick>#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);</lang>
 
{{omit from|Batch File|Does not have access to GUI functions.}}
Anonymous user