You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _build/reference/624-graphics-window.markdown
+42-30Lines changed: 42 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,21 +1,29 @@
1
1
# WINDOW
2
2
3
-
> WINDOW [x1,y2,x2,y1]
3
+
> WINDOW [x1,x2, y2, y1]
4
4
5
-
Specifies "world" coordinates for the screen.
5
+
Specifies "world" coordinates for the screen. The WINDOW command allows you to redefine the corners of the display screen as a pair of "world" coordinates. The coordinates of the upper-left corner of the screen is given by `[x1, y1]`, the lower-left corner by `[x2, y2]`.
6
6
7
-
The WINDOW command allows you to redefine the corners of the display screen as a pair of "world" coordinates.
7
+
The world space defined by WINDOW is disabled by a WINDOW command without parameters.
8
8
9
-
The world space defined by WINDOW is disabled by a WINDOW command with no parameters.
10
-
11
-
Note: the unusal coordinates are intended for Quick BASIC compatibility (possible bug).
@@ -24,7 +32,7 @@ WINDOW is also overloaded as a function, returning a system object which provide
24
32
25
33
### alert(message, title)
26
34
27
-
Display an alert message.
35
+
Display an alert window. The title of the window is `title` and the context is `message`.
28
36
29
37
```
30
38
w = window()
@@ -33,45 +41,49 @@ w.alert("This is an alert", "title")
33
41
34
42
### ask(message, title)
35
43
36
-
Display a prompt to retrieve a user selection.
44
+
Display a prompt window to retrieve a user selection. The choices are "Yes" and "No". The title of the window is `title` and the context is `message`. The answer is stored in the window-object variable `answer`: `0` for "Yes" and `1` for "No".
37
45
38
46
```
39
47
w = window()
48
+
40
49
w.ask("Yes or no?", "Question")
50
+
41
51
if w.answer == 0 then
42
-
w.alert("Yes!", "Answer")
52
+
print "Yes"
43
53
else
44
-
w.alert("No", "Answer")
54
+
print "No"
45
55
endif
46
56
```
47
57
48
58
### graphicsScreen1(), graphicsScreen2()
49
59
50
-
Select graphics mode screen 1 or 2 for output.
60
+
Select graphics mode screen 1 or 2 for output. When switching to a different screen, the context of the previous screen is stored in RAM. When switching back to the previous screen, the context will be restored.
51
61
52
62
```
53
-
dim v(30)
54
-
for i = 0 to 30
55
-
v[i] = rnd
56
-
next i
63
+
w = window()
57
64
58
-
sub draw_chart(n,s)
59
-
color 1,15: cls
60
-
chart n, v, s, 1, 1, xmax-2, ymax-2
61
-
end
65
+
w.graphicsScreen1() ' Set output to screen 1
66
+
rect 100,100 STEP 100,100, 15 filled
62
67
63
-
w = window()
64
-
w.graphicsScreen2(): draw_chart(1, 5)
65
-
w.graphicsScreen1(): draw_chart(2, 3)
68
+
w.graphicsScreen2() ' Set output to screen 2
69
+
rect 150,150 STEP 100,100, 14 filled
66
70
71
+
' Switch between both screens, no need to redaw the rectangles
67
72
while 1
68
-
b = !b
69
-
if b then w.graphicsScreen1() else w.graphicsscreen2()
70
-
pause
73
+
b = !b
74
+
if b then
75
+
w.graphicsScreen1()
76
+
else
77
+
w.graphicsscreen2()
78
+
endif
79
+
delay(500)
71
80
wend
72
81
```
82
+
73
83
### insetTextScreen(x, y, w, h)
74
84
85
+
Insert an area for text output at position `[x, y]` with width `w` and height `h`
0 commit comments