Hello world/Graphical: Difference between revisions
sort
Childishbeat (talk | contribs) m (→{{header|Nyquist}}: Now the code is described as being a plugin for Audacity, which it is.) |
(sort) |
||
(107 intermediate revisions by 49 users not shown) | |||
Line 11:
* [[Hello world/Text]]
<br><br>
=={{header|AArch64 Assembly}}==
{{works with|as|Raspberry Pi 3B version Buster 64 bits}}
<syntaxhighlight lang="aarch64 assembly">
/* ARM assembly AARCH64 Raspberry PI 3B */
/* program disMessGraph64.s */
/* link with gcc options -lX11 -L/usr/lpp/X11/lib */
/*******************************************/
/* Constantes file */
/*******************************************/
/* for this file see task include a file in language AArch64 assembly*/
.include "../includeConstantesARM64.inc"
.equ ClientMessage, 33
/*******************************************/
/* Initialized data */
/*******************************************/
.data
szRetourligne: .asciz "\n"
szMessErreur: .asciz "Server X11 not found.\n"
szMessErrfen: .asciz "Error create X11 window.\n"
szMessErrGC: .asciz "Error create Graphic Context.\n"
szMessGoodBye: .asciz "Goodbye World!"
szLibDW: .asciz "WM_DELETE_WINDOW" // message close window
/*******************************************/
/* UnInitialized data */
/*******************************************/
.bss
.align 4
qDisplay: .skip 8 // Display address
qDefScreen: .skip 8 // Default screen address
identWin: .skip 8 // window ident
wmDeleteMessage: .skip 16 // ident close message
stEvent: .skip 400 // provisional size
buffer: .skip 500
/**********************************************/
/* -- Code section */
/**********************************************/
.text
.global main // program entry
main:
mov x0,#0 // open server X
bl XOpenDisplay
cmp x0,#0
beq erreur
// Ok return Display address
ldr x1,qAdrqDisplay
str x0,[x1] // store Display address for future use
mov x28,x0 // and in register 28
// load default screen
ldr x2,[x0,#264] // at location 264
ldr x1,qAdrqDefScreen
str x2,[x1] //store default_screen
mov x2,x0
ldr x0,[x2,#232] // screen list
//screen areas
ldr x5,[x0,#+88] // white pixel
ldr x3,[x0,#+96] // black pixel
ldr x4,[x0,#+56] // bits par pixel
ldr x1,[x0,#+16] // root windows
// create window x11
mov x0,x28 //display
mov x2,#0 // position X
mov x3,#0 // position Y
mov x4,600 // weight
mov x5,400 // height
mov x6,0 // bordure ???
ldr x7,0 // ?
ldr x8,qBlanc // background
str x8,[sp,-16]! // argument fot stack
bl XCreateSimpleWindow
add sp,sp,16 // for stack alignement
cmp x0,#0 // error ?
beq erreurF
ldr x1,qAdridentWin
str x0,[x1] // store window ident for future use
mov x27,x0 // and in register 27
// Correction of window closing error
mov x0,x28 // Display address
ldr x1,qAdrszLibDW // atom name address
mov x2,#1 // False create atom if not exist
bl XInternAtom
cmp x0,#0
ble erreurF
ldr x1,qAdrwmDeleteMessage // address message
str x0,[x1]
mov x2,x1 // address atom create
mov x0,x28 // display address
mov x1,x27 // window ident
mov x3,#1 // number of protocoles
bl XSetWMProtocols
cmp x0,#0
ble erreurF
// create Graphic Context
mov x0,x28 // display address
mov x1,x27 // window ident
bl createGC // GC address -> x26
cbz x0,erreurF
// Display window
mov x1,x27 // ident window
mov x0,x28 // Display address
bl XMapWindow
ldr x0,qAdrszMessGoodBye // display text
bl displayText
1: // events loop
mov x0,x28 // Display address
ldr x1,qAdrstEvent // events structure address
bl XNextEvent
ldr x0,qAdrstEvent // events structure address
ldr w0,[x0] // type in 4 fist bytes
cmp w0,#ClientMessage // message for close window
bne 1b // no -> loop
ldr x0,qAdrstEvent // events structure address
ldr x1,[x0,56] // location message code
ldr x2,qAdrwmDeleteMessage // equal ?
ldr x2,[x2]
cmp x1,x2
bne 1b // no loop
mov x0,0 // end Ok
b 100f
erreurF: // error create window
ldr x0,qAdrszMessErrfen
bl affichageMess
mov x0,1
b 100f
erreur: // error no server x11 active
ldr x0,qAdrszMessErreur
bl affichageMess
mov x0,1
100: // program standard end
mov x8,EXIT
svc 0
qBlanc: .quad 0xF0F0F0F0
qAdrqDisplay: .quad qDisplay
qAdrqDefScreen: .quad qDefScreen
qAdridentWin: .quad identWin
qAdrstEvent: .quad stEvent
qAdrszMessErrfen: .quad szMessErrfen
qAdrszMessErreur: .quad szMessErreur
qAdrwmDeleteMessage: .quad wmDeleteMessage
qAdrszLibDW: .quad szLibDW
qAdrszMessGoodBye: .quad szMessGoodBye
/******************************************************************/
/* create Graphic Context */
/******************************************************************/
/* x0 contains the Display address */
/* x1 contains the ident Window */
createGC:
stp x20,lr,[sp,-16]! // save registers
mov x20,x0 // save display address
mov x2,#0
mov x3,#0
bl XCreateGC
cbz x0,99f
mov x26,x0 // save GC
mov x0,x20 // display address
mov x1,x26
ldr x2,qRed // code RGB color
bl XSetForeground
cbz x0,99f
mov x0,x26 // return GC
b 100f
99:
ldr x0,qAdrszMessErrGC
bl affichageMess
mov x0,0
100:
ldp x20,lr,[sp],16 // restaur 2 registers
ret // return to address lr x30
qAdrszMessErrGC: .quad szMessErrGC
qRed: .quad 0xFF0000
qGreen: .quad 0xFF00
qBlue: .quad 0xFF
qBlack: .quad 0x0
/******************************************************************/
/* display text on screen */
/******************************************************************/
/* x0 contains the address of text */
displayText:
stp x1,lr,[sp,-16]! // save registers
mov x5,x0 // text address
mov x6,0 // text size
1: // loop compute text size
ldrb w10,[x5,x6] // load text byte
cbz x10,2f // zero -> end
add x6,x6,1 // increment size
b 1b // and loop
2:
mov x0,x28 // display address
mov x1,x27 // ident window
mov x2,x26 // GC address
mov x3,#50 // position x
mov x4,#100 // position y
bl XDrawString
100:
ldp x1,lr,[sp],16 // restaur 2 registers
ret // return to address lr x30
/********************************************************/
/* File Include fonctions */
/********************************************************/
/* for this file see task include a file in language AArch64 assembly */
.include "../includeARM64.inc"
</syntaxhighlight>
=={{header|Action!}}==
<syntaxhighlight lang="action!">DEFINE PTR="CARD"
BYTE FUNC AtasciiToInternal(CHAR c)
BYTE c2
c2=c&$7F
IF c2<32 THEN
RETURN (c+64)
ELSEIF c2<96 THEN
RETURN (c-32)
FI
RETURN (c)
PROC CharOut(CARD x BYTE y CHAR c)
BYTE i,j,v
PTR addr
addr=$E000+AtasciiToInternal(c)*8;
FOR j=0 TO 7
DO
v=Peek(addr)
i=8
WHILE i>0
DO
IF (v&1)=0 THEN
Color=0
ELSE
Color=1
FI
Plot(x+i-1,y+j)
v=v RSH 1
i==-1
OD
addr==+1
OD
RETURN
PROC TextOut(CARD x BYTE y CHAR ARRAY text)
BYTE i
FOR i=1 TO text(0)
DO
CharOut(x,y,text(i))
x==+8
OD
RETURN
PROC Frame(CARD x BYTE y,width,height)
Color=1
Plot(x,y)
DrawTo(x+width-1,y)
DrawTo(x+width-1,y+height-1)
DrawTo(x,y+height-1)
DrawTo(x,y)
RETURN
PROC Main()
BYTE CH=$02FC,COLOR1=$02C5,COLOR2=$02C6
BYTE i,x,y,width=[122],height=[10]
Graphics(8+16)
COLOR1=$0C
COLOR2=$02
FOR i=1 TO 10
DO
x=Rand(320-width)
y=Rand(192-height)
Frame(x,y,width,height)
TextOut(x+1,y+1,"Goodbye, World!")
OD
DO UNTIL CH#$FF OD
CH=$FF
RETURN</syntaxhighlight>
{{out}}
[https://gitlab.com/amarok8bit/action-rosetta-code/-/raw/master/images/Hello_world_graphical.png Screenshot from Atari 8-bit computer]
=={{header|ActionScript}}==
<
var textField:TextField = new TextField();
stage.addChild(textField);
textField.text = "Goodbye, World!"
</syntaxhighlight>
=={{header|Ada}}==
{{libheader|GTK|GtkAda}}
{{libheader|GtkAda}}
<
with Gtk.Label; use Gtk.Label;
with Gtk.Window; use Gtk.Window;
Line 68 ⟶ 363:
Gtk.Main.Main;
end Windowed_Goodbye_World;</
=={{header|ALGOL 68}}==
The code below is a gentle re-write (including a bug fix) of that in
the Algol 68 Genie documentation.
<
BEGIN
FILE window;
Line 84 ⟶ 380:
close (window)
END
</syntaxhighlight>
[[Category:ALGOL 68#ALGOL 68]]
Line 97 ⟶ 393:
set Screen1.Title to "Goodbye World!"<br>
[https://lh6.googleusercontent.com/-0MGq3ZZTgT8/UuwF5KBd7-I/AAAAAAAAJ-c/HirntN5II9g/s1600/blocks.PNG VIEW THE BLOCKS AND ANDROID APP SCREEN]
=={{header|APL}}==
See [http://rosettacode.org/wiki/Simple_windowed_application Simple Windowed Application]
=={{header|AppleScript}}==
<
=={{header|Applesoft BASIC}}==
<
2 LET R = 5:GX = 3:GY = 2:O = 3:XC = R + GX:YC = R * 2 + GY
3 TEXT : HOME : TEXT : HGR : HCOLOR= 7: HPLOT 0,0: CALL 62454: HCOLOR= 6
Line 136 ⟶ 436:
108 HPLOT XC - R,YC - R * 2 TO XC - R,YC + R: GOTO 9: REM L
114 HPLOT XC - R,YC - R TO XC - R,YC + R:O = 2: GOTO 10: REM R
121 HPLOT XC - R,YC - R TO XC,YC + R: HPLOT XC + R,YC - R TO XC - R,YC + R * 3: RETURN : REM Y</
=={{header|Arendelle}}==
Line 165 ⟶ 465:
// done</pre>
=={{header|Arturo}}==
<syntaxhighlight lang="rebol">popup "" "Goodbye, World!"</syntaxhighlight>
{{out}}
Here, you can see what the [https://i.ibb.co/Y35c1Wc/Screenshot-2022-05-13-at-10-57-16.png popup box with our message] looks like (on macOS).
=={{header|ATS}}==
<syntaxhighlight lang="ats">//
#include
"share/atspre_define.hats"
Line 267 ⟶ 575:
val ((*void*)) = gtk_main ()
//
} (* end of [main0] *)</
=={{header|AutoHotkey}}==
<syntaxhighlight lang
<syntaxhighlight lang
<
Gui, Add, Edit, xp+90 yp-3, Goodbye, World!
Gui, Add, Button, xp+98 yp-1, OK
Gui, Show, w226 h22 , Rosetta Code
Return</
<
=={{header|AutoHotKey V2}}==
<syntaxhighlight lang="autohotkey">
MsgBox("Goodbye, World!")
</syntaxhighlight>
=={{header|AutoIt}}==
<
$hGUI = GUICreate("Hello World") ; Create the main GUI
Line 296 ⟶ 609:
EndSwitch
WEnd
</syntaxhighlight>
<
<
=={{header|AWK}}==
Line 310 ⟶ 623:
and [[Hello_world/Graphical#UNIX_Shell|UNIX_Shell]].
<
BEGIN { system("msg * Goodbye, Msgbox !") }
</syntaxhighlight>
=={{header|Axe}}==
This example is almost identical to the [[#TI-83_BASIC|TI-83 BASIC version]].
<
Text(0,0,"Goodbye, world!")
Pause 5000</
=={{header|BaCon}}==
Using Xaw backend:
<syntaxhighlight lang="bacon">OPTION GUI TRUE
gui = GUIDEFINE("{ type=window name=window XtNtitle=\"Graphical\" } \
{ type=labelWidgetClass name=label parent=window XtNlabel=\"Goodbye, World!\" } ")
CALL GUIEVENT$(gui)</syntaxhighlight>
Using GTK3 backend:
<syntaxhighlight lang="bacon">OPTION GUI TRUE
PRAGMA GUI gtk3
gui = GUIDEFINE("{ type=WINDOW name=window callback=delete-event title=\"Graphical\" } \
{ type=LABEL name=label parent=window margin=5 label=\"Goodbye, World!\" } ")
CALL GUIEVENT$(gui)</syntaxhighlight>
=={{header|BASIC}}==
{{works with|FreeBASIC}}
<
#include once "windows.bi"
Line 354 ⟶ 669:
MessageBox(NULL, "Goodbye World", "Goodbye World", MB_ICONINFORMATION)
function = 0
End Function</
<
#INCLUDE "gtk/gtk.bi"
Line 369 ⟶ 684:
gtk_main()
END 0</
=={{header|BASIC256}}==
<syntaxhighlight lang="basic256">clg
font "times new roman", 20,100
color orange
rect 10,10, 140,30
color red
text 10,10, "Goodbye, World!"</
=={{header|
<syntaxhighlight lang="batari basic"> playfield:
................................
................................
................................
.XX..XXX.XXX.XX..XX..X.X.XXX....
.X.X.X.X.X.X.X.X.XXX..X..XX...X.
.XXX.XXX.XXX.XX..XXX..X..XXX.X..
................................
.....X.X.XXX.XX..X...XX...X.....
.....XXX.X.X.XXX.X...X.X..X.....
.....XXX.XXX.X.X.XXX.XX..X......
................................
end
COLUPF = 15
COLUBK = 1
mainloop
drawscreen
goto mainloop
</syntaxhighlight>
=={{header|Batch File}}==
From Window 7 and later, pure Batch File does not completely provide GUI. However, <code>MSHTA.EXE</code> provides command-line JavaScript/VBScript access.
<
::Output to message box [Does not work in Window 7 and later]
Line 401 ⟶ 725:
@mshta javascript:alert("Goodbye, World!");code(close());
@mshta vbscript:Execute("msgbox(""Goodbye, World!""):code close")
pause</
=={{header|BBC BASIC}}==
{{works with|BBC BASIC for Windows}}
<
=={{header|Beads}}==
Beads specializes in graphical design and can use draw_str for html in the browser or alerts for popup boxes.
<syntaxhighlight lang="beads">beads 1 program 'Goodbye World'
calc main_init
alert('Goodbye, World!')
draw main_draw
draw_str('Goodbye, World!')</syntaxhighlight>
=={{header|BML}}==
<syntaxhighlight lang
=={{header|C}}==
=== GTK ===
{{libheader|GTK}}
<
int main (int argc, char **argv) {
Line 425 ⟶ 759:
gtk_main();
return 0;
}</
{{libheader|Win32}}
To compile with Visual C++: <code>cl /nologo hello.c user32.lib</code>, or with Open Watcom: <code>wcl386 /q hello.c user32.lib</code>.
<syntaxhighlight lang="c">#include <windows.h>
int main(void) {
MessageBox(NULL, TEXT("Goodbye, World!"), TEXT("Rosetta Code"), MB_OK | MB_ICONINFORMATION);
return 0;
}</syntaxhighlight>
=== OS/2 Presentation Manager ===
The following program shows a message box in OS/2 PM. Tested in ArcaOS.
To compile with Open Watcom:
<pre>wcc386 hello.c
wlink system os2v2_pm name hello file hello.obj</pre>
<syntaxhighlight lang="c">#include <os2.h>
int main(void) {
HAB hab;
HMQ hmq;
hab = WinInitialize(0);
hmq = WinCreateMsgQueue(hab, 0);
WinMessageBox(HWND_DESKTOP,
HWND_DESKTOP,
"Hello, Presentation Manager!",
"My Program",
0L,
0L);
WinDestroyMsgQueue(hmq);
WinTerminate(hab);
return 0;
}</syntaxhighlight>
=== Turbo C for DOS ===
Using the graphics library included with Turbo C. The BGI driver and the font must be in the same directory as the program (<code>EGAVGA.BGI</code> and <code>SANS.CHR</code>). Compile with <code>tcc hellobgi.c graphics.lib</code>.
<syntaxhighlight lang="c">#include <conio.h>
#include <graphics.h>
int main(void) {
int Driver = DETECT, Mode;
int MaxX, MaxY, X, Y;
char Message[] = "Hello, World!";
initgraph(&Driver, &Mode, "");
MaxX = getmaxx();
MaxY = getmaxy();
settextstyle(SANS_SERIF_FONT, HORIZ_DIR, 7);
X = (MaxX - textwidth(Message)) >> 1;
Y = (MaxY - textheight(Message)) >> 1;
outtextxy(X, Y, Message);
getch();
closegraph();
return 0;
}</syntaxhighlight>
=={{header|C sharp|C#}}==
Line 446 ⟶ 836:
{{libheader|Windows Forms}}
<
using System.Windows.Forms;
Line 454 ⟶ 844:
MessageBox.Show("Goodbye, World!");
}
}</
{{libheader|GTK}}
<
using GtkSharp;
Line 469 ⟶ 859:
Application.Run();
}
}</
=={{header|C++}}==
Line 475 ⟶ 865:
{{libheader|GTK}}<!-- c++ bindings -->
<
int main(int argc, char *argv[])
{
Line 481 ⟶ 871:
Gtk::MessageDialog msg("Goodbye, World!");
msg.run();
}</
{{libheader|Win32}}
All Win32 APIs work in C++ the same way as they do in C. See the C example.
Line 487 ⟶ 877:
{{libheader|MFC}}
Where pWnd is a pointer to a CWnd object corresponding to a valid window in the application.
<
void ShowGoodbyeWorld(CWnd* pWnd)
{
pWnd->SetWindowText(_T("Goodbye, World!"));
}</
{{libheader|FLTK}}
<
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
Line 511 ⟶ 901:
return Fl::run();
}
</syntaxhighlight>
=={{header|C++/CLI}}==
<
using namespace System::Windows::Forms;
Line 522 ⟶ 912:
return 0;
}
</syntaxhighlight>
=={{header|Casio BASIC}}==
To configure the "Graphical screen"
<syntaxhighlight lang="basic casio">ViewWindow 1,127,1,1,63,1
AxesOff
CoordOff
GridOff
LabelOff</syntaxhighlight>
ViewWindow parameters depend on the calculator resolution (These are the most common). <br>
To print text on the "Graphical screen" of the calculator:
<syntaxhighlight lang="basic casio">Text 1,1,"Goodbye, World!"
ClrGraph</syntaxhighlight>
=={{header|Clean}}==
{{libheader|Object I/O}}
<
Start :: *World -> *World
Line 532 ⟶ 934:
where
hello = Dialog "" (TextControl "Goodbye, World!" [])
[WindowClose (noLS closeProcess)]</
=={{header|Clojure}}==
<
(:import (javax.swing JOptionPane JFrame JTextArea JButton)
(java.awt FlowLayout)))
Line 549 ⟶ 951:
(.pack)
(.setDefaultCloseOperation (JFrame/EXIT_ON_CLOSE))
(.setVisible true)))</
=== With cljfx ===
{{libheader|cljfx}}
<syntaxhighlight lang="lisp">(ns example
(:require [cljfx.api :as fx]))
(fx/on-fx-thread
(fx/create-component
{:fx/type :stage
:showing true
:title "Cljfx example"
:width 300
:height 100
:scene {:fx/type :scene
:root {:fx/type :v-box
:alignment :center
:children [{:fx/type :label
:text "Goodbye, world"}]}}}))</syntaxhighlight>
=={{header|COBOL}}==
Line 558 ⟶ 978:
{{libheader|Windows Forms}}
{{trans|C#}}
<
METHOD-ID Main STATIC.
PROCEDURE DIVISION.
Line 564 ⟶ 984:
INVOKE TYPE MessageBox::Show("Goodbye, World!")
END METHOD.
END CLASS.</
{{libheader|Windows Presentation Foundation}}
gui.xaml.cbl:
<
INHERITS TYPE System.Windows.Window.
METHOD-ID NEW.
Line 574 ⟶ 994:
INVOKE self::InitializeComponent()
END METHOD.
END CLASS.</
gui.xaml:
<
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Hello world/Graphical">
<TextBox>Goodbye, World!</TextBox>
</Window></
===GTK===
{{works with|GnuCOBOL|2.0}}
{{libheader|cobweb-gtk}}
<
*> cobweb-gui-hello, using gtk-label
*> Tectonics:
Line 648 ⟶ 1,068:
goback.
end program cobweb-gui-hello.</
===TUI===
Line 655 ⟶ 1,075:
The program gets the lines and columns of the screen and positions the text in the middle. Program waits for a return key.
<
data division.
working-storage section.
Line 673 ⟶ 1,093:
end-display
accept var end-accept
stop run.</
=={{header|Cobra}}==
Line 679 ⟶ 1,099:
Requires {{libheader|GTK#}} GUI library.
<
@args -pkg:gtk-sharp-2.0
Line 694 ⟶ 1,114:
dialog.run
dialog.destroy
</syntaxhighlight>
=={{header|CoffeeScript}}==
<
=={{header|Commodore BASIC}}==
===Commodore 64===
There are no text drawing routines in BASIC that apply to the high resolution bitmap mode on the Commodore 64. Therefore, it is necessary to either draw letterforms from designs stored in RAM, or copy the font contained in ROM. It should be noted that using BASIC to handle high resolution graphics is a slow process, and the same tasks are much more efficiently accomplished in assembly language/machine code.
This example will iterate through the string and copy the appropriate bitmap information from the Character ROM. In line 425 a conversion must take place since strings are stored in memory as bytes of ASCII (PETSCII) codes, however, the Character ROM is stored in order of the screen codes as found in [https://www.commodore.ca/manuals/c64_programmers_reference/c64-programmers_reference_guide-07-appendices.pdf Appendix B] of the Commodore 64 Programmer's Reference Guide... And even then the conversion given will work only for a limited set of the Character ROM. This could be remedied if the Character ROM (or some other font definition) was copied to RAM and indexed in ASCII/PETSCII order.
The POKE statements encapsulating the text drawing routine (lines 410-415 and 450-455) are necessary to make the Character ROM visible to BASIC without crashing the operating system. As such, keyboard scanning must be suspended during this time, preventing the routine from any user interruption until it is finished.
<syntaxhighlight lang="commodorebasicv2">
1 rem hello world on graphics screen
2 rem commodore 64 version
10 print chr$(147): print " press c to clear bitmap area,"
15 print " any other key to continue"
20 get k$:if k$="" then 20
25 if k$<>"c" then goto 40
30 poke 53280,0:print chr$(147):print " clearing bitmap area... please wait..."
35 base=8192:for i=base to base+7999:poke i,0:next
40 print chr$(147);
45 poke 53272,peek(53272) or 8:rem set bitmap memory at 8192 ($2000)
50 poke 53265,peek(53265) or 32:rem enter bitmap mode
55 rem write text to graphics at tx,ty
60 t$="goodbye, world!":tx=10:ty=10
65 gosub 400
70 rem draw sine wave - prove we are in hi-res mode
75 for x=0 to 319:y=int(50*sin(x/10))+100:gosub 500:next
80 rem wait for keypress
85 get k$:if k$="" then 85
90 rem back to text mode, restore colors, end program
95 poke 53265,peek(53265) and 223:poke 53272,peek(53272) and 247
100 poke 53280,14:poke 53281,6:poke 646,14
200 end
400 rem write text to graphics routine
405 tx=tx+(40*ty):m=base+(tx*8)
410 poke 56334,peek(56334) and 254 : rem turn off keyscan
415 poke 1,peek(1) and 251 : rem switch in chargen rom
420 for i=1 to len(t$)
425 l=asc(mid$(t$,i,1))-64:if l<0 then l=l+64
430 for b=0 to 7
435 poke m,peek(53248+(l*8)+b)
440 m=m+1
445 next b, i
450 poke 1,peek(1) or 4 : rem switch in io
455 poke 56334,peek(56334) or 1 : rem restart keyscan
460 return
500 rem plot a single pixel at x,y
510 mem=base+int(y/8)*320+int(x/8)*8+(y and 7)
520 px=7-(x and 7)
530 poke mem,peek(mem) or 2^px
540 return
</syntaxhighlight>
=={{header|Common Lisp}}==
This can be done using the extension package ''ltk'' that provides an interface to the ''Tk'' library.
{{libheader|Tk}}
<
(defun show-message (text)
Line 716 ⟶ 1,197:
(mainloop))))
(show-message "Goodbye World")</
This can also be done using the ''CLIM 2.0'' specification. The following code runs on both SBCL and the LispWorks
IDE:
{{libheader|CLIM}}
<
(defclass hello-world-pane
Line 749 ⟶ 1,230:
(run-frame-top-level
(make-application-frame 'hello-world
:width 200 :height 200))</
=={{header|Creative Basic}}==
<syntaxhighlight lang="creative basic">
DEF Win:WINDOW
DEF Close:CHAR
Line 775 ⟶ 1,256:
RETURN
</syntaxhighlight>
=={{header|Crystal}}==
{{libheader|CrSFML}}
<syntaxhighlight lang="crystal">
require "crsfml"
window = SF::RenderWindow.new(SF::VideoMode.new(800, 600), "Hello world/Graphical")
# A font file(s) MUST be in the directory of the Crystal file itself.
# CrSFML does NOT load font files from the filesystem root!
font = SF::Font.from_file("DejaVuSerif-Bold.ttf")
text = SF::Text.new
text.font = font
text.string = "Goodbye, world!"
text.character_size = 24
text.color = SF::Color::Black
while window.open?
while event = window.poll_event
if event.is_a? SF::Event::Closed
window.close
end
end
window.clear(SF::Color::White)
window.draw(text)
window.display
end
</syntaxhighlight>
=={{header|D}}==
{{libheader|gtkD}}
<
class GoodbyeWorld : MainWindow {
Line 793 ⟶ 1,310:
new GoodbyeWorld();
Main.run();
}</
=={{header|Dart}}==
===Flutter===
{{libheader|Flutter}}
Because Flutter works on the Web in addition to Mobiles and Desktop, you can view these examples on Dartpad! - https://dartpad.github.io
Simplest (and ugliest) solution
<syntaxhighlight lang="javascript">import 'package:flutter/material.dart';
main() => runApp( MaterialApp( home: Text( "Goodbye, World!" ) ) );
</syntaxhighlight>
A still bare bones but much better looking example that displays a white screen with the text centered
<syntaxhighlight lang="javascript">import 'package:flutter/material.dart';
void main() {
runApp(
MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold (
body: Center (
child: Text( "Goodbye, World!")
)
)
)
);
}
</syntaxhighlight>
Html dom manipulation, Dart has first class support for compilation to JavaScript. This simply sets the innerHtml of the body to 'Goodbye, World!'
===Web/Javascript===
{{libheader|dart:html}}
<syntaxhighlight lang="javascript">import 'dart:html';
main() => document.body.innerHtml = '<p>Goodbye, World!</p>';
</syntaxhighlight>
{{trans|JavaScript}}
<syntaxhighlight lang="javascript">import 'dart:html';
main() => window.alert("Goodbye, World!");
</syntaxhighlight>
=={{header|Delphi}}==
<
uses
Line 803 ⟶ 1,364:
begin
ShowMessage('Goodbye, World!');
end.</
=={{header|Diego}}==
To differentiate only a GUI message use the <code>display_</code> verb.
<syntaxhighlight lang="diego">display_me()_msg(Goodbye, World!);</syntaxhighlight>
However, using the <code>_msg</code> (short for 'message') action will send a string message to the callee who may decide to display the string graphically...
<syntaxhighlight lang="diego">me_msg(Goodbye, World!);</syntaxhighlight>
=={{header|Dylan}}==
(This works entered into the interactive shell):
<
=={{header|E}}==
Line 815 ⟶ 1,382:
This is a complete application. If it were part of a larger application, the portions related to <code>interp</code> would be removed.
<
def SWT := <swt:makeSWT>
Line 831 ⟶ 1,398:
frame.open()
interp.blockAtTop()</
=={{header|EasyLang}}==
[https://easylang.dev/show/#cod=y80vS1UwNFAwMuAqSa0oUVByz89PSapM1VEIzy/KSVFU4gIA Run it]
<syntaxhighlight lang="text">
move 10 20
text "Goodbye, World!"
</syntaxhighlight>
=={{header|eC}}==
MessageBox:
<
MessageBox goodBye { contents = "Goodbye, World!" };</
Label:
<
Label label { text = "Goodbye, World!", hasClose = true, opacity = 1, size = { 320, 200 } };</
Titled Form + Surface Output:
<
class GoodByeForm : Window
Line 865 ⟶ 1,436:
}
GoodByeForm form {};</
=={{header|EchoLisp}}==
<
(alert "
</syntaxhighlight>
=={{header|EGL}}==
{{works with|EDT}}
Allows entry of any name into a text field (using "World" as the default entry). Then, when the "Say Goodbye" button is pressed, sets a text label to the value "Goodbye, <name>!".
<syntaxhighlight lang="egl">
import org.eclipse.edt.rui.widgets.*;
import dojo.widgets.*;
handler HelloWorld type RUIhandler{initialUI =[ui]}
ui Box {columns=1, children=[nameField, helloLabel, goButton]};
nameField DojoTextField {placeHolder = "What's your name?", text = "World"};
helloLabel TextLabel {};
goButton DojoButton {text = "Say Goodbye", onClick ::= onClick_goButton};
function onClick_goButton(e Event in)
helloLabel.text = "Goodbye, " + nameField.text + "!";
end
end
</syntaxhighlight>
=={{header|Elena}}==
ELENA
<
public class MainWindow : SDIDialog
Line 882 ⟶ 1,475:
constructor new()
<= super new()
{
goodByeWorldLabel := Label.new();
closeButton := Button.new();
self
.appendControl(goodByeWorldLabel)
.appendControl(closeButton);
self.setRegion(250, 200, 200, 110);
goodByeWorldLabel.Caption := "Goodbye, World!";
goodByeWorldLabel.setRegion(40, 10, 150, 30);
closeButton.Caption := "Close";
closeButton.setRegion(20, 40, 150, 30);
closeButton.onClick := (args){ forward program.stop() };
}
}</
=== Alternative version using xforms script ===
<syntaxhighlight lang="elena">import xforms;
const layout = "
<Form X=""250"" Y=""200"" Height=""110"" Width=""200"" Caption=""ELENA"">
<Label X=""40"" Y=""10"" Width=""150"" Height=""30"" Caption=""Goodbye, World!"">
</Label>
<Button X=""20"" Y=""40"" Width=""150"" Height=""30"" Caption=""Close"" onClick=""onExit"">
</Button>
</Form>";
public class MainWindow
{
Form;
constructor new()
{
Form := xforms.execute(layout, self);
}
onExit(arg)
{
forward program.stop()
}
dispatch() => Form;
}</syntaxhighlight>
=={{header|
<syntaxhighlight lang="lisp">
(message-box "Goodbye, World!")
</syntaxhighlight>
=={{header|Euphoria}}==
===Message box===
<syntaxhighlight lang="euphoria">include msgbox.e
integer response
response = message_box("Goodbye, World!","Bye",MB_OK)</syntaxhighlight>
=={{header|F_Sharp|F#}}==
Just display the text in a message box.
<
open System
open System.Windows.Forms
Line 940 ⟶ 1,547:
let main _ =
MessageBox.Show("Hello World!") |> ignore
0</
=={{header|Factor}}==
Line 948 ⟶ 1,555:
=={{header|Fantom}}==
<
using fwt
Line 958 ⟶ 1,565:
}
}
</syntaxhighlight>
=={{header|Fennel}}==
{{libheader|LÖVE}}
<syntaxhighlight lang="fennel">
(fn love.load []
(love.window.setMode 300 300 {"resizable" false})
(love.window.setTitle "Hello world/Graphical in Fennel!"))
(let [str "Goodbye, World!"]
(fn love.draw []
(love.graphics.print str 95 150)))
</syntaxhighlight>
To run this, you need to have LÖVE installed in your machine, and then run this command <code>fennel --compile love_test.fnl > main.lua; love .</code>. Since LÖVE has no compatibility with Fennel, we need to AOT-compile the file to a Lua file called <code>main.lua</code>, so then LÖVE can execute the program.
=={{header|Forth}}==
Line 964 ⟶ 1,584:
{{works with|SwiftForth}}
<
Alternative:
{{works with|Win32Forth|6.15.03}}
<
=={{header|Fortran}}==
Line 976 ⟶ 1,596:
{{works with|Absoft Pro Fortran}}
<
use windows
integer :: res
res = MessageBoxA(0, LOC("Hello, World"), LOC("Window Title"), MB_OK)
end program</
Compile with <code>af90 hello.f90 user32.lib</code> or for a 64-bit executable <code>af90 -i8 -m64 hello.f90 user32.lib</code>.
{{works with|Intel Fortran}}
<
use user32
integer :: res
res = MessageBox(0, "Hello, World", "Window Title", MB_OK)
end program</
Compile with <code>ifort hello.f90</code>.
Line 996 ⟶ 1,616:
Using [https://github.com/jerryd/gtk-fortran gtk-fortran] library
{{works with|GNU Fortran}}
<
module handlers_m
use iso_c_binding
Line 1,037 ⟶ 1,657:
end program test
</syntaxhighlight>
Compile with
<code>gfortran gtk2_mini.f90 -o gtk2_mini.x `pkg-config --cflags --libs gtk-2-fortran`</code>
Line 1,044 ⟶ 1,664:
'''Graphics Mode'''
{{works with|QBasic}}
<syntaxhighlight lang="freebasic">screen 1 'Mode 320x200
locate 12,15
? "Goodbye, World!"
sleep</
'''Windows API'''
<
MessageBox(0, "Goodbye, World!", "Message",0)</
=={{header|Frege}}==
<
import Java.Swing
Line 1,066 ⟶ 1,687:
cp.add label
frame.pack
frame.setVisible true</
=={{header|Frink}}==
Line 1,075 ⟶ 1,696:
The graphics are infinitely-scalable and can be rendered at full quality to any resolution. This program "shows off" by rotating the text by 10 degrees, and also rendering it to a printer (which can include tiling across multiple pages) and rendering to a graphics file. (Frink can automatically render the same graphics object to many image formats, including PNG, JPG, SVG, HTML5 canvas, animated GIF, bitmapped image in memory, and more.)
<
g = new graphics
g.font["SansSerif", 10]
Line 1,083 ⟶ 1,704:
g.print[] // Optional: render to printer
g.write["GoodbyeWorld.png", 400, 300] // Optional: write to graphics file
</syntaxhighlight>
=={{header|FunL}}==
<
native java.awt.Font
Line 1,102 ⟶ 1,723:
f.setVisible( true )
SwingUtilities.invokeLater( createAndShowGUI.runnable('Goodbye, World!') )</
=={{header|FutureBasic}}==
Easy peasy.
<syntaxhighlight lang="futurebasic">
alert 1, NSWarningAlertStyle, @"Goodbye, World!", @"It's been real.", @"See ya!", YES
HandleEvents
</syntaxhighlight>
=={{header|Gambas}}==
<
=={{header|Genie}}==
<
/*
Genie GTK+ hello
Line 1,125 ⟶ 1,757:
window.show_all()
window.destroy.connect(Gtk.main_quit)
Gtk.main()</
=={{header|GlovePIE}}==
The text is rendered using Braille text characters.
<
=={{header|GML}}==
<
=={{header|Go}}==
{{libheader|go-gtk}}
<
import "github.com/mattn/go-gtk/gtk"
Line 1,151 ⟶ 1,783:
win.ShowAll()
gtk.Main()
}</
=={{header|Groovy}}==
{{trans|Java}}
<
import javax.swing.JFrame
Line 1,166 ⟶ 1,798:
}
}
</syntaxhighlight>
=={{header|GUISS}}==
Line 1,172 ⟶ 1,804:
Here we display the message on the system notepad:
<
=={{header|Harbour}}==
<
RETURN wapi_MessageBox(,"Goodbye, World!","")
</syntaxhighlight>
=={{header|Haskell}}==
Using {{libheader|gtk}} from [http://hackage.haskell.org/packages/hackage.html HackageDB]
<
import Control.Monad
Line 1,193 ⟶ 1,825:
dialog `onDestroy` mainQuit
mainGUI</
Run in GHCi interpreter:
<syntaxhighlight lang
=={{header|HicEst}}==
<
=={{header|HolyC}}==
<
== Icon and Unicon ==
==={{header|Icon}}===
<
procedure main()
WOpen("size=100,20") | stop("No window")
WWrites("Goodbye, World!")
WDone()
end</
{{libheader|Icon Programming Library}}
[http://www.cs.arizona.edu/icon/library/src/gprocs/graphics.icn graphics is required ]
Line 1,230 ⟶ 1,849:
==={{header|Unicon}}===
<
import gui
$include "guih.icn"
Line 1,252 ⟶ 1,871:
w.show_modal ()
end
</syntaxhighlight>
=={{header|HPPPL}}==
With an alert box:
<syntaxhighlight lang="hpppl">MSGBOX("Goodbye, World!");</syntaxhighlight>
By drawing directly to the screen:
<syntaxhighlight lang="hpppl">RECT();
TEXTOUT_P("Goodbye, World!", GROBW_P(G0)/4, GROBH_P(G0)/4, 7);
WAIT(-1);</syntaxhighlight>
=={{header|i}}==
<syntaxhighlight lang="i">graphics {
display("Goodbye, World!")
}</syntaxhighlight>
=={{header|Integer BASIC}}==
Line 1,258 ⟶ 1,890:
40×40 isn't great resolution, but it's enough!
<
10 REM FONT DERIVED FROM 04B-09 BY YUJI OSHIMOTO
20 GR
Line 1,326 ⟶ 1,958:
660 VLIN 32,33 AT 33 : VLIN 32,33 AT 34
670 END
</syntaxhighlight>
=={{header|Ioke}}==
{{trans|Java}}
<
:javax:swing, :JOptionPane, :JFrame, :JTextArea, :JButton
)
Line 1,345 ⟶ 1,977:
setDefaultCloseOperation(JFrame field:EXIT_ON_CLOSE)
visible = true
)</
=={{header|IWBASIC}}==
<syntaxhighlight lang="iwbasic">
DEF Win:WINDOW
DEF Close:CHAR
Line 1,371 ⟶ 2,004:
RETURN
ENDSUB
</syntaxhighlight>
=={{header|J}}==
<syntaxhighlight lang
=={{header|Java}}==
{{libheader|Swing}}
<
import java.awt.*;
Line 1,401 ⟶ 2,034:
});
}
}</
Using Java 8 lambdas syntax:
<
import java.awt.*;
Line 1,425 ⟶ 2,058:
});
}
}</
=={{header|JavaScript}}==
<
=={{header|jq}}==
Line 1,441 ⟶ 2,074:
'''Part 1: Generic SVG-related functions'''
<
# e.g: "font-size: 40px; text-align: center;" (without the quotation marks)
def to_s:
Line 1,475 ⟶ 2,108:
| "<text x='\(x//0)' y='\(y//0)' style='\($style)'>
\(.)",
"</text>";</
'''Part 2: "Goodbye, World!"'''
<
svg(null;null), # use the defaults
linearGradient("gradient"; "rgb(255,255,0)"; "rgb(255,0,0)"), # define "gradient"
Line 1,483 ⟶ 2,116:
"</svg>";
task</
{{out}}
jq -n -r -f Hello_word_Graphical.jq > Hello_word_Graphical.svg
=={{header|JSE}}==
<syntaxhighlight lang="jse">Text 25,10,"Goodbye, World!"</syntaxhighlight>
=={{header|Jsish}}==
Line 1,500 ⟶ 2,136:
That is based on JSI CData, a blend of typed Javascript and C, interwoven via a preprocessor.
<
/*
Alert popup, via libAgar and Jsish CData
Line 1,542 ⟶ 2,178:
return rc;
}
};</
Build rules are ''jsish -c'' preprocessor, query ''jsish'' for C compile time flags, compile the C, load the module into jsish via ''require''.
Line 1,575 ⟶ 2,211:
As listed at the top, this GUI can be called up while in the interactive console.
=={{header|Julia}}==
{{libheader|Tk}}
<
window = Toplevel("Hello World", 200, 100, false)
Line 1,598 ⟶ 2,228:
set_visible(window, true)
# sleep(7)</
=={{header|Just Basic}}==
<syntaxhighlight lang="just basic">
print "Goodbye, World!"
'Prints in the upper left corner of the default text window: mainwin, a window with scroll bars.
</syntaxhighlight>
=={{header|KonsolScript}}==
Popping a dialog-box.
<
Konsol:Message("Goodbye, World!", "")
}</
Displaying it in a Window.
<
Screen:PrintString("Goodbye, World!")
while (B1 == false) {
Screen:Render()
}
}</
=={{header|Kotlin}}==
{{trans|Java}}
{{libheader|Swing}}
<
import javax.swing.*
Line 1,630 ⟶ 2,266:
isVisible = true
}
}</
=={{header|LabVIEW}}==
{{VI solution|LabVIEW_Hello_world_Graphical.png}}
=={{header|Lambdatalk}}==
<syntaxhighlight lang="scheme">
1) we add a new "alert" primitive to the lambdatalk's dictionary
{script
LAMBDATALK.DICT["alert"] = function() {
var args = arguments[0];
alert( args )
};
}
2) and we call it
{alert GoodBye World}
-> display a standard Alert WIndow.
</syntaxhighlight>
=={{header|Lasso}}==
On OS X machines:
<
=={{header|Liberty BASIC}}==
<
=={{header|Lingo}}==
Display in alert box:
<
Display in main window ("stage"):
<
m = new(#field)
m.rect = rect(0,0,320,240)
Line 1,662 ⟶ 2,315:
-- force immediate update
_movie.updateStage()</
=={{header|
Works in HyperCard and other xTalk environments
<syntaxhighlight lang="hypertalk"> answer "Goodbye, World!"</syntaxhighlight>
A dialog box can be modified as appropriate for the context by setting a "iconType", button text and title
<
=={{header|Lobster}}==
<
gl_setfontname("data/fonts/Droid_Sans/DroidSans.ttf")
gl_setfontsize(30)
Line 1,676 ⟶ 2,330:
while gl_frame():
gl_clear([ 0.0, 0.0, 0.0, 1.0 ])
gl_text("Goodbye, World!")</
=={{header|Logo}}==
Line 1,682 ⟶ 2,336:
Among the turtle commands are some commands for drawing text in the graphical area. Details and capabilities differ among Logo implementations.
<
SETLABELHEIGHT 2 * last LABELSIZE
LABEL [Goodbye, World!]</
=={{header|Lua}}==
==={{libheader|IUPLua}}===
<
dlg = iup.dialog{iup.label{title="Goodbye, World!"}; title="test"}
Line 1,695 ⟶ 2,349:
if (not iup.MainLoopLevel or iup.MainLoopLevel()==0) then
iup.MainLoop()
end</
==={{libheader|LÖVE}}===
Line 1,708 ⟶ 2,362:
or a shortcut to love.exe.
<
function love.draw()
love.graphics.print("Goodbye, World!", 400, 300)
end
</syntaxhighlight>
=={{header|M2000 Interpreter}}==
A window with a click event to open a message box, and print returned number to window form, scrolling at the lower part of form's layer.
<syntaxhighlight lang="m2000 interpreter">
Module CheckIt {
Declare Simple Form
Line 1,744 ⟶ 2,398:
}
CheckIt
</syntaxhighlight>
A simple Window only
<syntaxhighlight lang="m2000 interpreter">
Module CheckIt {
Declare Simple Form
Line 1,755 ⟶ 2,409:
}
CheckIt
</syntaxhighlight>
=={{header|Maple}}==
<syntaxhighlight lang="maple">
Maplets:-Display( Maplets:-Elements:-Maplet( [ "Goodbye, World!" ] ) );
</syntaxhighlight>
=={{header|Mathematica}} / {{header|Wolfram Language}}==
<
=={{header|MATLAB}}==
<syntaxhighlight lang
Add text to a graphical plot.
<
=={{header|MAXScript}}==
<
=={{header|MiniScript}}==
This implementation is for use with the [http://miniscript.org/MiniMicro Mini Micro] version of MiniScript.
<syntaxhighlight lang="miniscript">
import "textUtil"
hello = textUtil.Dialog.make("Hello, World Dialog", "Hello, World!")
hello.show
</syntaxhighlight>
=={{header|mIRC Scripting Language}}==
<
dialog -m Goodbye Goodbye
}
Line 1,788 ⟶ 2,448:
option dbu
text "Goodbye, World!", 1, 20 6 41 7
}</
=={{header|Modula-3}}==
{{libheader|Trestle}}
<
IMPORT TextVBT, Trestle;
Line 1,803 ⟶ 2,463:
Trestle.Install(v);
Trestle.AwaitDelete(v);
END GUIHello.</
This code requires an m3makefile.
<pre>
Line 1,821 ⟶ 2,481:
{{works with|All implementations of TROFF}}
<syntaxhighlight lang
=={{header|Neko}}==
The NekoVM uses a C FFI that requires marshaling of C types to Neko ''value'' types.
{{libheader|Agar}}
<
Tectonics:
gcc -shared -fPIC -o nekoagar.ndll nekoagar.c `agar-config --cflags --libs`
Line 1,942 ⟶ 2,602:
return alloc_int(rc);
}
DEFINE_PRIM(agar_eventloop, 0);</
The C file above is used to create a Neko friendly Dynamic Shared Object file, nekoagar.ndll.
Line 1,949 ⟶ 2,609:
The Neko program follows:
<syntaxhighlight lang="actionscript">/**
<doc><pre>
Hello world, graphical, in Neko, via Agar label
Line 1,982 ⟶ 2,642:
/* Run the event loop */
agar_eventloop();</
{{out}}
Line 1,993 ⟶ 2,653:
=={{header|Nemerle}}==
Compile with:<pre>ncc -reference:System.Windows.Forms goodbye.n</pre>
<
using System.Windows.Forms;
MessageBox.Show("Goodbye, World!")</
=={{header|NetRexx}}==
Using [[Java|Java's]] [http://download.oracle.com/javase/6/docs/technotes/guides/swing/index.html Swing Foundation Classes].
{{libheader|Swing}}
<
options replace format comments java crossref symbols binary
Line 2,008 ⟶ 2,668:
msgText = 'Goodbye, World!'
JOptionPane.showMessageDialog(null, msgText)
</syntaxhighlight>
An alternative version using other Swing classes.
{{libheader|Swing}}
<
options replace format comments java crossref symbols binary
Line 2,039 ⟶ 2,699:
method isFalse() public static returns boolean
return \isTrue
</syntaxhighlight>
An example using [[Java|Java's]] [http://download.oracle.com/javase/6/docs/technotes/guides/awt/index.html Abstract Window Toolkit (AWT)]
{{libheader|AWT}}
<
options replace format comments java crossref symbols binary
Line 2,132 ⟶ 2,792:
method isFalse() public static returns boolean
return \isTrue
</syntaxhighlight>
=={{header|newLISP}}==
Line 2,138 ⟶ 2,798:
NewLISP uses a lightweight Java GUI server that it communicates with over a pipe, similar how some languages use Tcl/Tk. This takes advantage of Java's cross platform GUI capability.
<
; oofoe 2012-01-18
Line 2,161 ⟶ 2,821:
(exit) ; NewLisp normally goes to listener after running script.
</syntaxhighlight>
<
> (! "dialog --msgbox GoodbyeWorld! 5 20")
; A dialog message box appears on terminal similar to yes/no box. </
=={{header|Nim}}==
==={{libheader|GTK2}}===
<
gtk2.nim_init()
info(nil, "Hello World")</
==={{libheader|IUP}}===
<
discard iup.open(nil, nil)
message("Hello", "Hello World")
close()</
=={{header|NS-HUBASIC}}==
<syntaxhighlight lang="ns-hubasic">10 LOCATE 6,11
20 PRINT "GOODBYE, WORLD!"</syntaxhighlight>
=={{header|Nyquist}}==
===Audacity
<
;version
;type tool
;name "Goodbye
(print "Goodbye, World!")</syntaxhighlight>
===Audacity plug-in (SAL syntax)===
<syntaxhighlight lang="sal">;nyquist plug-in
;version 4
;type tool
;codetype sal
;name "Goodbye World"
return "Goodbye, World!"</syntaxhighlight>
=={{header|Objeck}}==
{{libheader|Qt}}
<
use Qt;
Line 2,217 ⟶ 2,881:
}
}
</syntaxhighlight>
=={{header|Objective-C}}==
To show a modal alert (Mac):
<syntaxhighlight lang="objc">NSAlert *alert = [[NSAlert alloc] init];
[alert setMessageText:@"Goodbye, World!"];
[alert runModal];</syntaxhighlight>
To show a modal alert (iOS):
<syntaxhighlight lang="objc">UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Goodbye, World!" message:nil delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];</syntaxhighlight>
=={{header|OCaml}}==
{{libheader|GTK}}
<
let destroy () = GMain.Main.quit ()
Line 2,235 ⟶ 2,908:
;;
let _ = main () ;;</
{{libheader|OCaml-Xlib}}
Line 2,244 ⟶ 2,917:
Just output as a label in a window:
<
let main_widget = Tk.openTk () in
let lbl = Label.create ~text:"Goodbye, World" main_widget in
Tk.pack [lbl];
Tk.mainLoop();;</
Output as text on a button that exits the current application:
<
let action () = exit 0 in
let main_widget = Tk.openTk () in
Line 2,257 ⟶ 2,930:
Button.create main_widget ~text:"Goodbye, World" ~command:action in
Tk.pack [bouton_press];
Tk.mainLoop();;</
=={{header|Ol}}==
{{libheader|Win32}}
<syntaxhighlight lang="ol">
(import (lib winapi))
(MessageBox #f (c-string "Hello, World!") (c-string "Rosettacode") #x40)
</syntaxhighlight>
=={{header|OpenEdge/Progress}}==
<syntaxhighlight lang="progress (openedge abl)">MESSAGE "Goodbye, World!" VIEW-AS ALERT-BOX.</syntaxhighlight>
=={{header|OxygenBasic}}==
Line 2,281 ⟶ 2,955:
<br clear=both>
Requires a Glade GUI description file. 'ere be one I produced earlier:
<
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.24.dtd">
Line 2,305 ⟶ 2,979:
</glade-interface>
</syntaxhighlight>
And finally the Oxygene:
<
// Display a Message in a GUI Window
//
Line 2,355 ⟶ 3,029:
end.
</syntaxhighlight>
===.NET===
[[File:OxygeneNEThw.jpg|left|HelloWorld]]
<br clear=both>
<
namespace HelloWorldNET;
Line 2,378 ⟶ 3,052:
end.
</syntaxhighlight>
=={{header|Oz}}==
<
[QTk] = {Module.link ['x-oz://system/wp/QTk.ozf']}
Window = {QTk.build td(label(text:"Goodbye, World!"))}
in
{Window show}</
=={{header|Panoramic}}==
<syntaxhighlight lang="panoramic">print "Goodbye, World!"
'Prints in the upper left corner of the window.
</syntaxhighlight>
=={{header|PARI/GP}}==
<
plotstring(1, "Goodbye, World!");
plotdraw([1, 0, 15]);</
=={{header|Pascal}}==
Line 2,403 ⟶ 3,075:
{{libheader|Gtk2}}
Variant of the C example:
<
uses
Line 2,424 ⟶ 3,096:
gtk_main();
end.</
=={{header|PascalABC.NET}}==
<syntaxhighlight lang="pascal">
// Hello world/Graphical. Nigel Galloway: January 16th., 2023
begin
System.Windows.Forms.MessageBox.Show('Farewell Cruel World!')
end.
</syntaxhighlight>
=={{header|Perl}}==
{{works with|Perl|5.8.8}}
Line 2,432 ⟶ 3,111:
Just output as a label in a window:
<
use strict;
use warnings;
Line 2,439 ⟶ 3,118:
my $main = MainWindow->new;
$main->Label(-text => 'Goodbye, World')->pack;
MainLoop();</
Output as text on a button that exits the current application:
<
use warnings;
use Tk;
Line 2,452 ⟶ 3,131:
-command => \&exit,
)->pack;
MainLoop();</
==={{libheader|Perl/Gtk2}}===
<
use warnings;
use Gtk2 '-init';
Line 2,469 ⟶ 3,148:
$window->show_all;
Gtk2->main;</
==={{libheader|Perl/Qt}}===
<
use warnings;
use QtGui4;
Line 2,479 ⟶ 3,158:
my $label = Qt::Label('Goodbye, World');
$label->show;
exit $app->exec;</
=={{header|Phix}}==
{{libheader|
<!--<syntaxhighlight lang="phix">(phixonline)-->
<span style="color: #008080;">include</span> <span style="color: #000000;">pGUI</span><span style="color: #0000FF;">.</span><span style="color: #000000;">e</span>
<span style="color: #7060A8;">IupOpen</span><span style="color: #0000FF;">()</span>
<span style="color: #7060A8;">IupMessage</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"Bye"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"Goodbye, World!"</span><span style="color: #0000FF;">)</span>
<span style="color: #7060A8;">IupClose</span><span style="color: #0000FF;">()</span>
<!--</syntaxhighlight>-->
=== better ===
{{libheader|Phix/online}}
You can run this online [http://phix.x10.mx/p2js/hello_world.htm here]. A few improvements are probably warranted, as in changes to pGUI.js and/or pGUI.css, but at least the language/transpiler side of things is pretty much complete.
<!--<syntaxhighlight lang="phix">(phixonline)-->
<span style="color: #000080;font-style:italic;">--
-- pwa\phix\hello_world.exw
-- ========================
--</span>
<span style="color: #008080;">with</span> <span style="color: #008080;">javascript_semantics</span>
<span style="color: #008080;">include</span> <span style="color: #000000;">pGUI</span><span style="color: #0000FF;">.</span><span style="color: #000000;">e</span>
<span style="color: #7060A8;">IupOpen</span><span style="color: #0000FF;">()</span>
<span style="color: #004080;">Ihandle</span> <span style="color: #000000;">lbl</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">IupFlatLabel</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"World!"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"EXPAND=YES, ALIGNMENT=ACENTER"</span><span style="color: #0000FF;">)</span>
<span style="color: #004080;">Ihandln</span> <span style="color: #000000;">dlg</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">IupDialog</span><span style="color: #0000FF;">(</span><span style="color: #000000;">lbl</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"TITLE=Hello, RASTERSIZE=215x85"</span><span style="color: #0000FF;">)</span>
<span style="color: #7060A8;">IupShow</span><span style="color: #0000FF;">(</span><span style="color: #000000;">dlg</span><span style="color: #0000FF;">)</span>
<span style="color: #008080;">if</span> <span style="color: #7060A8;">platform</span><span style="color: #0000FF;">()!=</span><span style="color: #004600;">JS</span> <span style="color: #008080;">then</span>
<span style="color: #7060A8;">IupMainLoop</span><span style="color: #0000FF;">()</span>
<span style="color: #000000;">dlg</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">IupDestroy</span><span style="color: #0000FF;">(</span><span style="color: #000000;">dlg</span><span style="color: #0000FF;">)</span>
<span style="color: #7060A8;">IupClose</span><span style="color: #0000FF;">()</span>
<span style="color: #008080;">end</span> <span style="color: #008080;">if</span>
<!--</syntaxhighlight>-->
=={{header|PHP}}==
{{libheader|PHP-GTK}}
<
{
die("Please load the php-gtk2 module in your php.ini\r\n");
Line 2,515 ⟶ 3,206:
$wnd->show_all();
Gtk::main();</
=={{header|PicoLisp}}==
<
=={{header|Plain English}}==
<syntaxhighlight lang="plainenglish">To run:
Start up.
Clear the screen.
Write "Goodbye, World!".
Refresh the screen.
Wait for the escape key.
Shut down.</syntaxhighlight>
=={{header|Portugol}}==
<syntaxhighlight lang="portugol">
programa {
// includes graphics library and use an alias
inclua biblioteca Graficos --> g
// define WIDTH and HEIGHT integer constants
const inteiro WIDTH = 200
const inteiro HEIGHT = 100
// main entry
funcao inicio() {
// begin graphical mode (verdadeiro = true)
g.iniciar_modo_grafico(verdadeiro)
// define window title
g.definir_titulo_janela("Hello")
// define window dimesions
g.definir_dimensoes_janela(WIDTH, HEIGHT)
// while loop
enquanto (verdadeiro) {
// define color to black(preto) and clear window
g.definir_cor(g.COR_PRETO)
g.limpar()
// define color to white(branco)
g.definir_cor(g.COR_BRANCO)
// set text font size
g.definir_tamanho_texto(32.0)
// draws text
g.desenhar_texto(0, HEIGHT / 3, "Hello, world!")
// calls render function
g.renderizar()
}
// end graphical mode
g.encerrar_modo_grafico()
}
}
</syntaxhighlight>
=={{header|PostScript}}==
In the general Postscript context, the <tt>show</tt> command will render the string that is topmost on the stack at the <tt>currentpoint</tt> in the previously <tt>setfont</tt>. Thus a minimal PostScript file that will print on a PostScript printer or previewer might look like this:
<
% render in Helvetica, 12pt:
/Helvetica findfont 12 scalefont setfont
Line 2,531 ⟶ 3,276:
(Goodbye, World!) show
% wrap up page display:
showpage</
=={{header|PowerBASIC}}==
{{works with|PB/Win}}
<
MSGBOX "Goodbye, World!"
END FUNCTION</
=={{header|PowerShell}}==
{{libheader|WPK}}<br/>
{{works with|PowerShell|2}}
<
{{libheader|Windows Forms}}
<
$label = New-Object System.Windows.Forms.Label
Line 2,553 ⟶ 3,298:
$form.Controls.Add($label)
$Form.ShowDialog() | Out-Null</
Alternatively, simply as a message box:
{{libheader|Windows Forms}}
<
=={{header|Processing}}==
Uses default Processing methods and variables.
<syntaxhighlight lang="processing">
fill(0, 0, 0);
text("Goodbye, World!",0,height/2);
</syntaxhighlight>
=={{header|Prolog}}==
Works with SWI-Prolog and XPCE. <br><br>
A simple message box :
<
A more sophisticated window :
<
new(D, window('Goodbye')),
send(D, size, size(250, 100)),
Line 2,580 ⟶ 3,328:
send(D, display, T, point(XT, YT)),
send(D, open).
</syntaxhighlight>
=={{header|Pure Data}}==
Line 2,598 ⟶ 3,341:
* While there is no easy (intuitive) way to print a comma (or semicolon) this pd script will do.
* When writing messages to the terminal window, Pd prepends the name of the print object and a colon, or "print: " if no name is specified, which can be avoided by using "-n" instead of a name. This behaviour, however, has not been adopted by Pd-extended :-(
=={{header|PureBasic}}==
<syntaxhighlight lang="purebasic">MessageRequester("Hello","Goodbye, World!")</syntaxhighlight>
Using the Windows API:
<syntaxhighlight lang="purebasic">MessageBox_(#Null,"Goodbye, World!","Hello")</syntaxhighlight>
=={{header|Python}}==
{{works with|Python & Blender|3.x}}
==={{libheader|Blender}}===
<syntaxhighlight lang="python">import bpy
# select default cube
bpy.data.objects['Cube'].select_set(True)
# delete default cube
bpy.ops.object.delete(True)
# add text to Blender scene
bpy.data.curves.new(type="FONT", name="Font Curve").body = "Hello World"
font_obj = bpy.data.objects.new(name="Font Object", object_data=bpy.data.curves["Font Curve"])
bpy.context.scene.collection.objects.link(font_obj)
# camera center to text
bpy.context.scene.camera.location = (2.5,0.3,10)
# camera orient angle to text
bpy.context.scene.camera.rotation_euler = (0,0,0)
# change 3D scene to view from the camera
area = next(area for area in bpy.context.screen.areas if area.type == 'VIEW_3D')
area.spaces[0].region_3d.view_perspective = 'CAMERA'</syntaxhighlight>
{{works with|Python|2.x}}
==={{libheader|Tkinter}}===
<
result = tkMessageBox.showinfo("Some Window Label", "Goodbye, World!")</
'''Note:''' The result is a string of the button that was pressed.
Line 2,610 ⟶ 3,383:
{{works with|Python|3.x}}
{{libheader|Tkinter}}
<
result = messagebox.showinfo("Some Window Label", "Goodbye, World!")</
==={{libheader|PyQt}}===
<
app = PyQt4.QtGui.QApplication([])
pb = PyQt4.QtGui.QPushButton('Hello World')
pb.connect(pb,PyQt4.QtCore.SIGNAL("clicked()"),pb.close)
pb.show()
exit(app.exec_())</
==={{libheader|PyGTK}}===
<
pygtk.require('2.0')
import gtk
Line 2,632 ⟶ 3,405:
window.connect('delete-event', gtk.main_quit)
window.show_all()
gtk.main()</
==={{libheader|VPython}}===
{{works with|Python|2.7.5}}
<
# HelloWorld for VPython - HaJo Gurt - 2014-09-20
from visual import *
Line 2,691 ⟶ 3,464:
S.rotate( angle=rot, axis=(0,1,0) )
</syntaxhighlight>
==={{libheader|WxPython}}===
<
app = wx.App(False)
frame = wx.Frame(None, wx.ID_ANY, "Hello, World")
frame.Show(True)
app.MainLoop()</
==={{libheader|Kivy}}===
<
from kivy.app import App
from kivy.uix.floatlayout import FloatLayout
Line 2,724 ⟶ 3,497:
GoodByeApp().run()
</syntaxhighlight>
==={{libheader|Kivy}}===
With kv language
<
from kivy.app import App
Line 2,760 ⟶ 3,533:
GoodByeApp().run()
</syntaxhighlight>
=={{header|
<syntaxhighlight lang="Quackery"> [ $ "turtleduck.qky" loadfile ] now!
[ $ /
import turtle
size = from_stack()
words = string_from_stack()
turtle.write(words,align="center",
font=("Arial", size, "normal"))
/ python ] is write
turtle 0 frames
255 times
[ clear
i^ 3 of colour
$ "Goodbye, World!"
i write
frame ]</syntaxhighlight>
{{out}}
[[File:Quackery Goodbye World.gif]]
=={{header|R}}==
{{libheader|GTK}}
Rather minimalist, but working...
<
w <- gtkWindowNew()
l <- gtkLabelNew("Goodbye, World!")
w$add(l)</
=={{header|Racket}}==
<
(require racket/gui/base)
Line 2,793 ⟶ 3,586:
; Show the frame by calling its show method
(send frame show #t)</
=={{header|Raku}}==
(formerly Perl 6)
{{works with|Rakudo|2018.03}}
{{libheader|GTK}}
<syntaxhighlight lang="raku" line>use GTK::Simple;
use GTK::Simple::App;
my GTK::Simple::App $app .= new;
$app.border-width = 20;
$app.set-content( GTK::Simple::Label.new(text => "Goodbye, World!") );
$app.run;</syntaxhighlight>
=={{header|RapidQ}}==
<syntaxhighlight lang="rapidq">MessageBox("Goodbye, World!", "RapidQ example", 0)</syntaxhighlight>
=={{header|Rascal}}==
<
import vis::Figure;
import vis::Render;
Line 2,802 ⟶ 3,611:
public void GoodbyeWorld() =
render(box(text("Goodbye World")));
</syntaxhighlight>
Output:
[[File:Goodbyeworld.png]]
=={{header|REALbasic}}==
<syntaxhighlight lang="vb">
MsgBox("Goodbye, World!")
</syntaxhighlight>
=={{header|REBOL}}==
<
=={{header|Red}}==
<
=={{header|REXX}}==
Line 2,822 ⟶ 3,631:
:::* PC/REXX
:::* Personal REXX
<
if fcnPkg('rxWindow') ¬== 1 then do
say 'RXWINDOW function package not loaded.'
Line 2,834 ⟶ 3,643:
call w_put window#, 2, 2, center("Goodbye, World!", 80-2)
/*stick a fork in it, all we're done. */</
'''output'''
<pre>
Line 2,849 ⟶ 3,658:
<br>and it creates two windows, the first (main) window contains the '''Goodbye, World!''' text,
<br>the other "help" window contains a message about how to close the windows.
<
parse upper version !ver .; !pcrexx= !ver=='REXX/PERSONAL' | !ver=='REXX/PC'
if ¬!pcrexx then call ser "This isn't PC/REXX" /*this isn't PC/REXX ? */
Line 2,877 ⟶ 3,686:
parse var curPos row col
call cursor row, col
/*stick a fork in it, we're all done. */</
=={{header|Ring}}==
<
Load "guilib.ring"
New qApp {
Line 2,889 ⟶ 3,698:
exec()
}
</syntaxhighlight>
=={{header|Robotic}}==
Since visuals are already built in, [[Hello world/Newbie#Robotic|this link]] does the same thing.
=={{header|RPL}}==
{{works with|HP|48G}}
"Goodbye world!" MSGBOX
=={{header|Ruby}}==
{{libheader|GTK}}
<
window = Gtk::Window.new
Line 2,900 ⟶ 3,716:
window.show_all
Gtk.main</
{{libheader|Ruby/Tk}}
<
root = TkRoot.new("title" => "User Output")
TkLabel.new(root, "text"=>"CHUNKY BACON!").pack("side"=>'top')
Tk.mainloop</
{{libheader|Shoes}}
<
Shoes.app do
para "CHUNKY BACON!", :size => 72
end</
{{libheader|Gosu}}
<
require 'gosu'
Line 2,932 ⟶ 3,748:
end
Window.new.show</
{{libheader|Green shoes}}
<
#_Note: this code must not be executed through a GUI
require 'green_shoes'
Line 2,942 ⟶ 3,758:
para "Hello world"
end
</syntaxhighlight>
{{libheader|Win32ole}}
<
require 'win32ole'
WIN32OLE.new('WScript.Shell').popup("Hello world")
</syntaxhighlight>
=={{header|Run BASIC}}==
<
html "<script>alert('Goodbye, World!');</script>"</
=={{header|Rust}}==
==={{libheader|GTK}}===
<
extern crate gtk;
use gtk::traits::*;
Line 2,977 ⟶ 3,793:
window.show_all();
gtk::main();
}</
=={{header|Scala}}==
Line 2,984 ⟶ 3,800:
===Ad hoc REPL solution===
Ad hoc solution as [http://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop REPL] script:
<
===JVM Application===
Longer example, as an application:
<
object GoodbyeWorld extends SimpleSwingApplication {
Line 2,998 ⟶ 3,814:
}
}
}</
===.Net Framework===
<
object HelloDotNetWorld {
Line 3,007 ⟶ 3,823:
("Goodbye, World!")
}
}</
=={{header|Scheme}}==
Line 3,016 ⟶ 3,829:
{{libheader|Scheme/PsTk}}
<
#!r6rs
Line 3,032 ⟶ 3,845:
(tk-event-loop tk)
</syntaxhighlight>
=={{header|
<syntaxhighlight lang="scilab">messagebox("Goodbye, World!")</syntaxhighlight>
=={{header|Scratch}}==
[[File:Scratch_Hello_World_Graphical.png]]
=={{header|ScratchScript}}==
<syntaxhighlight lang="scratchscript">pos -100 70
print "Goodbye, World!"</syntaxhighlight>
This example waits until the mouse is clicked for the program to end. This can be useful if the program executes too fast for "Hello world!" to be visible on the screen long enough for it to be comfortable.
<syntaxhighlight lang="scratchscript">pos -100 70
print "Goodbye, World!"
delayOnClick</syntaxhighlight>
=={{header|Seed7}}==
Line 3,047 ⟶ 3,870:
the area is currently covered or off screen.
<
include "draw.s7i";
include "keybd.s7i";
Line 3,067 ⟶ 3,890:
write(screen, "Goodbye, World");
ignore(getc(KEYBOARD));
end func;</
=={{header|SenseTalk}}==
<syntaxhighlight lang="sensetalk">Answer "Good Bye" </syntaxhighlight>
=={{header|Sidef}}==
{{libheader|Tk}}
<
var main = %
main.Button(
'-text' => 'Goodbye, World!',
'-command' => 'exit',
).pack
tk.MainLoop
{{libheader|Gtk2}}
<
var window = %O<Gtk2::Window>.new
var label = %O<Gtk2::Label>.new('Goodbye, World!')
window.set_title('Goodbye, World!')
window.signal_connect(destroy => { gtk2.main_quit })
window.add(label)
window.show_all
gtk2.main</syntaxhighlight>
{{libheader|Gtk3}}
<syntaxhighlight lang="ruby">use('Gtk3 -init')
var gtk3 = %O'Gtk3'
var window = %O'Gtk3::Window'.new
var label = %O'Gtk3::Label'.new('Goodbye, World!')
window.set_title('Goodbye, World!')
window.signal_connect(destroy => { gtk3.main_quit })
window.add(label)
window.show_all
gtk3.main</syntaxhighlight>
=={{header|Slope}}==
The gui module is an optional module when you compile the slope interpreter. With the module installed the following will produce a window with the text "Goodbye, world!" and the title of the window will be "Goodbye".
<syntaxhighlight lang="slope">
(define gui (gui-create))
(gui-add-window gui "Goodbye")
(window-set-content
gui
"Goodbye"
(container
"max"
(widget-make-label "Goodbye, world!")))
(window-show-and-run gui "Goodbye")</syntaxhighlight>
=={{header|Smalltalk}}==
{{works with|GNU Smalltalk}}
<
{{works with|Pharo}}
<syntaxhighlight lang="smalltalk">'Hello World' asMorph openInWindow</syntaxhighlight>
{{works with|Smalltalk/X}}
{{works with|VisualWorks Smalltalk}}
<
=={{header|SmileBASIC}}==
<
=={{header|SSEM}}==
Ok, I know this is cheating. But it isn't <i>completely</i> cheating: the SSEM uses Williams tube storage, so the memory is basically a CRT device; and this is an executable program, up to a point, because the first line includes a <tt>111 Stop</tt> instruction (disguised as a little flourish joining the tops of the <b>d</b> and the <b>b</b>).
<
10000000000001010000000000000000
10011101110111011101010111000000
Line 3,122 ⟶ 3,979:
00100100101010100010010100000000
00100100101110100011011100100000
00011011000000000000000000000000</
Once you've keyed it in, the first eighteen words of storage will look a bit like this:
<pre> oo ooo
Line 3,142 ⟶ 3,999:
o o o ooo o oo ooo o
oo oo</pre>
=={{header|Standard ML}}==
Works with PolyML
<syntaxhighlight lang="standard ml">open XWindows ;
open Motif ;
val helloWindow = fn () =>
let
val shell = XtAppInitialise "" "demo" "top" [] [XmNwidth 400, XmNheight 300 ] ;
val main = XmCreateMainWindow shell "main" [XmNmappedWhenManaged true ] ;
val text = XmCreateLabel main "show" [ XmNlabelString "Hello World!"]
in
(
XtManageChildren [text];
XtManageChild main;
XtRealizeWidget shell
)
end;
</syntaxhighlight>
call
helloWindow ();
=={{header|Stata}}==
<
=={{header|Supernova}}==
<
=={{header|Swift}}==
{{trans|Objective-C}}
<
let alert = NSAlert()
alert.messageText = "Goodbye, World!"
alert.runModal()</
=={{header|Tcl}}==
{{libheader|Tk}}
Just output as a label in a window:
<
Output as text on a button that exits the current application:
<
''Note:'' If you name this program "button.tcl", you might get strange errors. <br>
Don't use the name of any internal tcl/tk-command as a filename for a tcl-script.
This shows our text in a message box:
<
=={{header|TI-83 BASIC}}==
<
:Text(0,0,"GOODBYE, WORLD!")</
=={{header|TI-89 BASIC}}==
<
Text "Goodbye, World!"
EndDlog</
=={{header|Tosh}}==
<syntaxhighlight lang="tosh">when flag clicked
say "Goodbye, World!"
stop this script</syntaxhighlight>
=={{header|True BASIC}}==
<syntaxhighlight lang="qbasic">SET WINDOW 0, 320, 0, 200
SET COLOR "YELLOW"
BOX AREA 20,50,40,60
SET COLOR "GREEN"
PLOT TEXT, AT 25, 45: "Goodbye, World!"
END</syntaxhighlight>
=={{header|TXR}}==
Line 3,183 ⟶ 4,079:
==== Microsoft Windows ====
<
(deffi messagebox "MessageBoxW" int (cptr wstr wstr uint)))
(messagebox cptr-null "Hello" "World" 0) ;; 0 is MB_OK</
=={{header|UNIX Shell}}==
===In a virtual terminal===
Using whiptail or dialog
<
whiptail --title 'Farewell' --msgbox 'Goodbye, World!' 7 20
</syntaxhighlight>
<
dialog --title 'Farewell' --msgbox 'Goodbye, World!' 7 20
</syntaxhighlight>
===In a graphical environment===
Using the simple dialog command xmessage, which uses the X11 Athena Widget library
<
xmessage 'Goodbye, World!'
</syntaxhighlight>
Using the zenity modal dialogue command (wraps GTK library) available with many distributions of [[Linux]]
<
zenity --info --text='Goodbye, World!'
</syntaxhighlight>
Using yad (a fork of zenity with many more advanced options)
<
yad --title='Farewell' --text='Goodbye, World!'
</syntaxhighlight>
=={{header|Ultimate++}}==
{{works with|TheIDE}}
The following code is altered from the TheIDE example page. It displays a blank GUI with a menu. Click on about from the menu and the goodbye world prompt appears.
<syntaxhighlight lang="cpp">
#include <CtrlLib/CtrlLib.h>
// submitted by Aykayayciti (Earl Lamont Montgomery)
using namespace Upp;
class GoodbyeWorld : public TopWindow {
MenuBar menu;
StatusBar status;
void FileMenu(Bar& bar);
void MainMenu(Bar& bar);
void About();
public:
typedef GoodbyeWorld CLASSNAME;
GoodbyeWorld();
};
void GoodbyeWorld::About()
{
PromptOK("{{1@5 [@9= This is the]::@2 [A5@0 Ultimate`+`+ Goodbye World sample}}");
}
void GoodbyeWorld::FileMenu(Bar& bar)
{
bar.Add("About..", THISBACK(About));
bar.Separator();
bar.Add("Exit", THISBACK(Close));
}
void GoodbyeWorld::MainMenu(Bar& bar)
{
menu.Add("File", THISBACK(FileMenu));
}
GoodbyeWorld::GoodbyeWorld()
{
AddFrame(menu);
AddFrame(status);
menu.Set(THISBACK(MainMenu));
status = "So long from the Ultimate++ !";
}
GUI_APP_MAIN
{
SetLanguage(LNG_ENGLISH);
GoodbyeWorld().Run();
}
</syntaxhighlight>
=={{header|Vala}}==
<
using Gtk;
Line 3,244 ⟶ 4,188:
Gtk.main();
}</
=={{header|VBA}}==
{{trans|Visual Basic}}
<
MsgBox "Goodbye, World!"
End Sub</
=={{header|VBScript}}==
<syntaxhighlight lang="vbscript">
MsgBox("Goodbye, World!")
</syntaxhighlight>
=={{header|Vedit macro language}}==
Displaying the message on status line. The message remains visible until the next keystroke, but macro execution continues.
<syntaxhighlight lang="vedit">Statline_Message("Goodbye, World!")</syntaxhighlight>
Displaying a dialog box with the message and default OK button:
<syntaxhighlight lang="vedit">Dialog_Input_1(1,"`Vedit example`,`Goodbye, World!`")</syntaxhighlight>
=={{header|Visual Basic}}==
<
MsgBox "Goodbye, World!"
End Sub</
=={{header|Visual Basic .NET}}==
{{works with|Visual Basic|2005}}
<
Module GoodbyeWorld
Line 3,264 ⟶ 4,222:
Messagebox.Show("Goodbye, World!")
End Sub
End Module</
=={{header|Visual FoxPro}}==
<
MESSAGEBOX("Goodbye, World!")
* Version 2:
? "Goodbye, World!"</
=={{header|V (Vlang)}}==
<syntaxhighlight lang="v (vlang)">import ui
fn main() {
ui.message_box('Hello World')
}</syntaxhighlight>
=={{header|Web 68}}==
<syntaxhighlight lang="web68">@1Introduction.
Define the structure of the program.
@aPROGRAM goodbye world CONTEXT VOID USE standard
BEGIN
@<Included declarations@>
@<Logic at the top level@>
END
FINISH
@ Include the graphical header file.
@iforms.w@>
@ Program code.
@<Logic...@>=
open(LOC FILE,"",arg channel);
fl initialize(argc,argv,NIL,0);
fl show messages("Goodbye World!");
fl finish
@ Declare the necessary macros.
@<Include...@>=
macro fl initialize;
macro fl show messages;
macro fl finish;
@ The end.</syntaxhighlight>
=={{header|Wee Basic}}==
<
end</
=={{header|Wren}}==
{{libheader|DOME}}
<syntaxhighlight lang="wren">import "graphics" for Canvas, Color
class Game {
static init() {
Canvas.print("Goodbye, World!", 10, 10, Color.white)
}
static update() {}
static draw(alpha) {}
}</syntaxhighlight>
=={{header|X86 Assembly}}==
Line 3,284 ⟶ 4,295:
function parameters onto the stack and the stack has been fixed up
when the callee returns.
<
;;;
;;; nasm -fwin32 hellowin.asm
Line 3,310 ⟶ 4,321:
title:
db 'RosettaCode sample',0
</syntaxhighlight>
{{works with|FASM on Windows}}
<
;use win32ax for 32 bit
;use win64ax for 64 bit
Line 3,323 ⟶ 4,334:
invoke ExitProcess,0
.end start
</syntaxhighlight>
=={{header|
===UASM 2.52===
Not sure if ncurses counts as 'graphical', but whatver..
===={{libheader|ncurses}}====
<syntaxhighlight lang="asm">
option casemap:none
printf proto :qword, :vararg
exit proto :dword
;; curses.h stuff
initscr proto ;; WINDOW *initsrc(void);
endwin proto ;; int endwin(void);
start_color proto ;; int start_color(void);
wrefresh proto :qword ;; int wrefresh(WINDOW *w);
wgetch proto :qword ;; int wgetch(WINDOW *w)
waddnstr proto :qword, :qword, :dword ;; int waddnstr(WINDOW *w, const char *str, int n);
;; Just a wrapper to make printing easier..
println proto :qword, :qword
.code
main proc
local stdscr:qword
call initscr
mov stdscr, rax
call start_color
invoke println, stdscr, CSTR("Goodbye, World!",10)
invoke wgetch, stdscr
call endwin
invoke exit, 0
ret
main endp
println proc wnd:qword, pstr:qword
invoke waddnstr, wnd, pstr, -1
invoke wrefresh, wnd
ret
println endp
end
</syntaxhighlight>
===={{libheader|GTK}}====
<syntaxhighlight lang="asm">
option casemap:none
gtk_main proto
gtk_main_quit proto
gtk_window_get_type proto
gtk_widget_show_all proto :qword
exit proto :dword
gtk_window_new proto :dword
printf proto :dword, :vararg
g_type_check_instance_cast proto :qword, :qword
gtk_init proto :qword, :qword
gtk_window_set_title proto :qword, :qword
g_signal_connect_data proto :qword, :qword, :qword, :dword, :dword, :dword
del_event proto
.data
tlt db "hello_gtk",0
agc dq 1
agv dq ags
ags dq tlt
dq 0
.code
main proc
local hwnd:qword
local tmp:qword
invoke printf, CSTR("-> Starting GTK with argc:%i - argv ptr: 0x%x",10), agc, agv
lea rax, agc
lea rbx, agv
invoke gtk_init, rax, rbx
invoke gtk_window_new, 0
mov hwnd, rax
invoke printf, CSTR("-> Main window handle: %d",10), hwnd
call gtk_window_get_type
mov tmp, rax
invoke printf, CSTR("-> Window type: %d",10), tmp
invoke g_type_check_instance_cast, hwnd, tmp
mov tmp, rax
invoke gtk_window_set_title, tmp, CSTR("Goodbye, World.")
invoke g_type_check_instance_cast, hwnd, 0x50
mov tmp, rax
lea rax, del_event
invoke g_signal_connect_data, tmp, CSTR("delete-event"), rax, 0, 0, 0
invoke gtk_widget_show_all, hwnd
call gtk_main
;invoke exit, 0
ret
main endp
del_event proc
invoke printf, CSTR("-> Exit event called..",10)
call gtk_main_quit
ret
del_event endp
end
</syntaxhighlight>
=={{header|XPL0}}==
This sets up a 320x200x8 (VGA) graphics screen and writes text on it.
<syntaxhighlight lang="xpl0">[SetVid($13); Text(6, "Goodbye, World!")]</syntaxhighlight>
=={{header|XSLT}}==
Line 3,361 ⟶ 4,447:
The output is an SVG document. The idea is that it's straightforward to use XSLT to turn an existing SVG into an instantiable template.
<
<xsl:output method="xml"/>
<xsl:template match="/*">
Line 3,381 ⟶ 4,467:
</svg>
</xsl:template>
</xsl:stylesheet></
Sample input:
<
Sample output (with formatting non-destructively adjusted):
<
<rect x="0" y="0" width="400" height="200" fill="cyan"/>
<circle cx="200" cy="100" r="50" fill="yellow"/>
Line 3,396 ⟶ 4,482:
text-anchor: middle;
fill: black;">Goodbye, World!</text>
</svg></
=={{header|Yabasic}}==
<
text 10, 20, "Hello world"
color 255, 0, 0 : text 10, 40, "Good bye world", "roman14"</
=={{header|zkl}}==
zkl doesn't have a decent GUI ffi but, on my Linux box, the following work:
<
System.cmd(0'|notify-send "Goodbye, World!"|); // desktop notification
System.cmd(0'|xmessage -buttons Ok:0,"Not sure":1,Cancel:2 -default Ok -nearmouse "Goodbye, World!" -timeout 10|); // X Windows dialog</
The quote quote syntax is 0'<char>text<char> or you can use \ (eg "\"Goodbye, World!\"")
{{omit from|ACL2}}
{{omit from|LFE}}
{{omit from|Logtalk}}
|