Window creation: Difference between revisions

→‎{{header|PureBasic}}: expanding the task
(Added Odin variant)
(→‎{{header|PureBasic}}: expanding the task)
 
(4 intermediate revisions by 4 users not shown)
Line 810:
gsv+close drop
[THEN]</syntaxhighlight>
 
===iMops===
{{works with|iMops on MacOS}}
<syntaxhighlight lang="iMops">
 
Window+ w \ create a window
View v \ create a view
300 30 430 230 put: frameRect \ size a rectangle for the view
frameRect " Test" docWindow v new: w \ activate the view and window
show: w \ display the window
 
</syntaxhighlight>
 
=={{header|FreeBASIC}}==
Line 1,821 ⟶ 1,833:
 
=={{header|PureBasic}}==
<syntaxhighlight lang="purebasic">Define MyWin.i MyWin, Event.i, x, y
x = 400
y = 300
 
MyWin =If OpenWindow(#PB_Any0, 4120, 1720, 402x, 94y, "I am a window - PureBasic", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
If CreateImage(0, x, y) And StartDrawing(ImageOutput(0))
 
DrawingMode(#PB_2DDrawing_Transparent)
; Event loop
Box(0, 0, x, y, #White)
Repeat
Event For i = WaitWindowEvent()1 To 10
DrawText(x/3, y/2, "Hello World!", #Black)
Select Event
;DrawText(Random(200), Random(200), "Hello World!", RGB(Random(255), Random(255), Random(255)))
Next i
StopDrawing()
ImageGadget(0, 0, 0, x, y, ImageID(0))
EndIf
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_Gadget
; Handle any gadget events here
Case #PB_Event_CloseWindow
Break
EndSelect
ForEver</syntaxhighlight>
EndIf</syntaxhighlight>
 
=={{header|Python}}==
Line 2,540 ⟶ 2,564:
newForm.Show()</syntaxhighlight>
 
=={{header|V (Vlang)}}==
<syntaxhighlight lang="Zig">
import gg
import gx
 
fn main() {
mut app := gg.new_context(
bg_color: gx.white
resizable: true
create_window: true
width: 600
height: 600
frame_fn: frame
window_title: "Empty Window"
)
app.run()
}
 
fn frame(mut ctx gg.Context) {
ctx.begin()
ctx.end()
}
</syntaxhighlight>
 
=={{header|Wren}}==
{{libheader|DOME}}
<syntaxhighlight lang="ecmascriptwren">import "dome" for Window
 
class EmptyWindow {
Line 2,710 ⟶ 2,758:
 
{{omit from|Batch File|No access to GUI functions.}}
{{omit from|EasyLang}}
{{omit from|Logtalk}}
{{omit from|Maxima}}
2,122

edits