Simple windowed application: Difference between revisions
Content added Content deleted
m (→{{header|Web 68}}: removed head/tail redundant new lines,) |
(Add XPL0) |
||
Line 1,809: | Line 1,809: | ||
and the resulting form definition file was converted to Web 68 by the program |
and the resulting form definition file was converted to Web 68 by the program |
||
<b>fdtow68</b>.</lang> |
<b>fdtow68</b>.</lang> |
||
=={{header|XPL0}}== |
|||
<lang XPL0>include c:\cxpl\stdlib; \standard library provides mouse routines, etc. |
|||
def Ww=40, Wh=12, Wx=(80-Ww)/2, Wy=(25-Wh)/2; \window width, etc. |
|||
def Bw=11, Bh=4, Bx=Wx+(Ww-Bw)/2, By=Wy+3*(Wh-Bh)/4; \button size & position |
|||
int Clicks, Mx, My; \number of clicks and mouse coordinates |
|||
[ShowCursor(false); \turn off flashing cursor |
|||
Attrib($1F); \bright white characters on blue |
|||
SetWind(Wx, Wy, Wx+Ww, Wy+Wh, 2, true); \blue window with no scroll |
|||
DrawBox(Wx, Wy, Wx+Ww, Wy+Wh, 3); \draw borders |
|||
Cursor(Wx+5, Wy+3); Text(6, "There have been no clicks yet."); |
|||
DrawBox(Bx, By, Bx+Bw, By+Bh, 0); \draw button |
|||
Cursor(Bx+2, By+2); Text(6, "Click me"); |
|||
OpenMouse; |
|||
ShowMouse(true); |
|||
Clicks:= 0; |
|||
repeat if GetMouseButton(0) then \left button down |
|||
[while GetMouseButton(0) do []; \wait for release |
|||
Mx:= GetMousePosition(0) / 8; \character coordinates |
|||
My:= GetMousePosition(1) / 8; |
|||
if Mx>=Bx & Mx<=Bx+Bw & My>=By & My<=By+Bh then |
|||
[Clicks:= Clicks+1; \mouse pointer is on the button |
|||
Cursor(Wx+4, Wy+3); |
|||
Text(6, "Times button has been clicked: "); |
|||
IntOut(6, Clicks); |
|||
]; |
|||
]; |
|||
until ChkKey; \keystroke terminates program |
|||
SetVid(3); \turn off mouse and turn on flashing cursor |
|||
]</lang> |
|||
=={{header|Yorick}}== |
=={{header|Yorick}}== |