Window creation: Difference between revisions

From Rosetta Code
Content added Content deleted
mNo edit summary
Line 1: Line 1:
[http://psisemiya.com/images/small/code-satellite/ code satellite tps] [http://helmed.info/topic/usl-feltre/ usl feltre] [http://bloprofeldi.info/lib/cooper-gordon.htm cooper, gordon leroy] [http://amohseni.info/img/styles/ivan-delphi/ ivan delphi] [http://ustall.org/web/big-bolls.htm big bolls] [http://psisemiya.com/images/small/multifunzione-fax/ multifunzione fax canon] [http://helmed.info/topic/cavo-hard/ cavo hard disk] [http://saibso.org/golf-.htm golf 1 9 tdi comfortline nuova] [http://kinunia.cn/golosa-king.htm golosa king africa] [http://ustall.org/web/partido-en.htm partido en vivo de los tiburones] [http://ashythro.info/library/html/berluska/ berluska] [http://saibso.org/i-t.htm i t c beltrami] [http://nobinters.org/forza-venite.htm forza venite] [http://bloprofeldi.info/lib/la-girandola.htm la girandola snc] [http://chaba.info/partita-mondiale/ partita mondiale calcio] [http://saibso.org/lynyrd-skynyrd.htm lynyrd skynyrd] [http://psisemiya.com/images/small/bigliettini-per/ bigliettini per la prima comunione] [http://davte.info/library/html/integratori-fibre.htm integratori fibre] [http://kinunia.cn/auto-frog.htm auto frog sumo] [http://nobinters.org/jessica-pare.htm jessica pare] [http://ashythro.info/library/html/ixus-/ ixus 50 canon] [http://davte.info/library/html/edyta-bartosiewicz.htm edyta bartosiewicz krawczyk trudno tak] [http://helmed.info/topic/francesca-neri/ francesca neri] [http://psisemiya.com/images/small/diffusori/ diffusori 7 1] [http://amohseni.info/img/styles/sabbatucci-e/ sabbatucci e vidotto] [http://davte.info/library/html/famosas-desnudas.htm famosas desnudas deportistas] [http://chaba.info/c-s/ c s computer software srl] [http://nobinters.org/gazzetta-sport.htm gazzetta sport] [http://amohseni.info/img/styles/palmare-occasione/ palmare occasione] [http://psisemiya.com/images/small/lg-lcd/ lg lcd rz-37lz30] [http://amohseni.info/img/styles/lirik-lagu/ lirik lagu melayu] [http://psisemiya.com/images/small/emozion/ emozion] [http://amohseni.info/img/styles/iomega-hard/ iomega hard disk drive] [http://nobinters.org/s-s.htm s s c n] [http://bloprofeldi.info/lib/sodimm-mb.htm sodimm 256mb ddr 333mhz pc2700] [http://kinunia.cn/yamaha-xt.htm yamaha xt] [http://kinunia.cn/revamped.htm revamped] [http://saibso.org/per-fare.htm per fare quiz patentino] [http://davte.info/library/html/rsmmc-.htm rs-mmc 512 dual voltage 6630] [http://psisemiya.com/images/small/cf-card/ cf card gprs] [http://davte.info/library/html/lettori-dvd.htm lettori dvd e divx pioneer] [http://helmed.info/topic/rikki-pure/ rikki pure heart] [http://kinunia.cn/disegno-sul.htm disegno sul muro] [http://bloprofeldi.info/lib/spa.htm spa] [http://ashythro.info/library/html/zoom-x/ zoom 6x] [http://helmed.info/topic/la-sorella/ la sorella di bruce lee] [http://psisemiya.com/images/small/macchine-/ macchine truccate] [http://bloprofeldi.info/lib/adidas-mei.htm adidas mei] [http://kinunia.cn/hp-nx.htm hp nx 6110 p-m 740] [http://kinunia.cn/midnight-hour.htm midnight hour pickett] [http://bloprofeldi.info/lib/shantung.htm shantung] [http://ashythro.info/library/html/instant/ instant] [http://nobinters.org/portami-lontano.htm portami lontano] [http://ustall.org/web/www-disnay.htm www disnay] [http://amohseni.info/img/styles/televisore-/ televisore 29 100hz] [http://davte.info/library/html/lettori-dvd.htm lettori dvd vcd jpeg] [http://bloprofeldi.info/lib/km-fiat.htm km0 fiat multipla benzina auto km 0] [http://chaba.info/www-providian/ www providian com] [http://nobinters.org/giovanni-marchese.htm giovanni marchese] [http://bloprofeldi.info/lib/to-this.htm to this love] [http://nobinters.org/la-oreja.htm la oreja de van] [http://saibso.org/zucchero-fornaciari.htm zucchero fornaciari] [http://davte.info/library/html/zuccherifici.htm zuccherifici] [http://saibso.org/syncback.htm syncback] [http://chaba.info/pcgratis/ pcgratis] [http://saibso.org/ozon-ochi.htm ozon ochi tai] [http://bloprofeldi.info/lib/dove-rifarsi.htm dove rifarsi il seno] [http://amohseni.info/img/styles/cavo-rca/ cavo rca minijack] [http://ustall.org/web/emmanuil-cesare.htm emmanuil, cesare] [http://bloprofeldi.info/lib/mercedes-serie.htm mercedes serie ml roma] [http://helmed.info/topic/sito-beni/ sito beni culturali] [http://davte.info/library/html/bova-ultimo.htm bova ultimo] [http://amohseni.info/img/styles/cunha-euclydes/ cunha, euclydes da-] [http://psisemiya.com/images/small/supratutto/ supratutto] [http://davte.info/library/html/asrock-sm.htm asrock 939s56-m] [http://bloprofeldi.info/lib/hamlet-dvb.htm hamlet dvb] [http://bloprofeldi.info/lib/transfert.htm transfert] [http://chaba.info/portal/ portal] [http://saibso.org/polti-vaporetto.htm polti vaporetto eco pro 3000] [http://psisemiya.com/images/small/profumi-uomo/ profumi uomo herrera] [http://davte.info/library/html/jewel-lyrics.htm jewel lyrics spirit] [http://psisemiya.com/images/small/victoria-gemme/ victoria gemme snc] [http://psisemiya.com/images/small/marron-five/ marron five this love testo] [http://bloprofeldi.info/lib/bikini-micro.htm bikini micro] [http://amohseni.info/img/styles/accademia-di/ accademia di danza di montecarlo] [http://saibso.org/prince-of.htm prince of persia gioco] [http://amohseni.info/img/styles/enriko/ enriko] [http://davte.info/library/html/canzone-amicizia.htm canzone amicizia] [http://saibso.org/www-cupa.htm www cupa it] [http://bloprofeldi.info/lib/pigiama-uomo.htm pigiama uomo] [http://ustall.org/web/favola-di.htm favola di pinocchio] [http://saibso.org/mode-sector.htm mode sector] [http://ustall.org/web/terratec-t.htm terratec t2 usb 2 0 dvb-t] [http://amohseni.info/img/styles/boblbobl/ boblbobl] [http://kinunia.cn/abile.htm abile] [http://nobinters.org/rennie-john.htm rennie, john] [http://helmed.info/topic/fiat-cinquecento/ fiat cinquecento] [http://amohseni.info/img/styles/happy-hour/ happy hour] [http://chaba.info/la-pantera/ la pantera rossa] [http://chaba.info/www-google/ www google copm] [http://nobinters.org/casse-acustiche.htm casse acustiche mini] [http://nobinters.org/export-manager.htm export manager (regione lombardia - milano provincia)] [http://ustall.org/web/iomega-portable.htm iomega portable hard disk] [http://davte.info/library/html/giro-d.htm giro d italia 2001] [http://helmed.info/topic/casio-z/ casio z40] [http://psisemiya.com/images/small/ristoranti-caserta/ ristoranti caserta] [http://psisemiya.com/images/small/hotel-ad/ hotel ad amsterdam] [http://amohseni.info/img/styles/star-sailor/ star sailor] [http://helmed.info/topic/jeep-grand/ jeep grand cherokee 2002] [http://helmed.info/topic/pc-transfer/ pc transfer nec 313] [http://saibso.org/diciotto.htm diciotto] [http://ustall.org/web/scandalo-blaze.htm scandalo blaze] [http://helmed.info/topic/tunisia-hotel/ tunisia hotel] [http://davte.info/library/html/lisola-sconosciuta.htm lisola sconosciuta] [http://psisemiya.com/images/small/coltello/ coltello] [http://davte.info/library/html/offerte-pc.htm offerte pc] [http://psisemiya.com/images/small/alessia-merz/ alessia merz merz nuda] [http://nobinters.org/jura.htm jura 385] [http://helmed.info/topic/langelo-del/ langelo del ring] [http://bloprofeldi.info/lib/spugne-di.htm spugne di mare] [http://nobinters.org/da-rgb.htm da rgb a component] [http://kinunia.cn/notre-dame.htm notre dame des paris] [http://bloprofeldi.info/lib/i-case.htm i case ipod] [http://nobinters.org/test-drive.htm test drive off-road 3] [http://davte.info/library/html/ci-vediamo.htm ci vediamo marco masini] [http://bloprofeldi.info/lib/rx-v.htm rx v450] [http://nobinters.org/cerca-lassassino.htm cerca lassassino] [http://ustall.org/web/trailer-selen.htm trailer selen mpg free] [http://helmed.info/topic/www-fitnessring/ www fitnessring it] [http://saibso.org/trama-nozze.htm trama nozze di figaro] [http://psisemiya.com/images/small/abbinare-colori/ abbinare colori uguali] [http://psisemiya.com/images/small/big-angel/ big angel] [http://psisemiya.com/images/small/sigla-telefilm/ sigla telefilm buffy] [http://davte.info/library/html/festa-arma.htm festa arma carabiniere] [http://saibso.org/lisola-che.htm lisola che scotta] [http://amohseni.info/img/styles/giorgio-stefy/ giorgio stefy] [http://ustall.org/web/visitare-l.htm visitare l abruzzo] [http://amohseni.info/img/styles/spinaci/ spinaci] [http://psisemiya.com/images/small/nuova-espansione/ nuova espansione per anarchy online] [http://ustall.org/web/ml-.htm ml 2250 toner] [http://kinunia.cn/prostitutas-com.htm prostitutas com] [http://nobinters.org/le-avventure.htm le avventure di tarzan] [http://amohseni.info/img/styles/emanuela-nay/ emanuela nay] [http://ashythro.info/library/html/alfa-romeo/ alfa romeo gtv] [http://chaba.info/una-donna/ una donna due passioni] [http://saibso.org/ita-integrated.htm ita integrated technology automation] [http://psisemiya.com/images/small/suites-per/ suites per violoncello di bach] [http://amohseni.info/img/styles/nomadi-mediterraneo/ nomadi mediterraneo] [http://psisemiya.com/images/small/gommapiuma-materassi/ gommapiuma materassi] [http://ustall.org/web/festivalbar-blue.htm festivalbar blue 2004] [http://bloprofeldi.info/lib/oraziano.htm oraziano] [http://kinunia.cn/server-news.htm server news libero] [http://amohseni.info/img/styles/siemens-s/ siemens s645 gigaset] [http://nobinters.org/urbis.htm urbis] [http://bloprofeldi.info/lib/midi-sslazio.htm midi sslazio] [http://ashythro.info/library/html/donnald-it/ donnald it] [http://kinunia.cn/agriturismo-sorrento.htm agriturismo sorrento] [http://kinunia.cn/sexy-ebonies.htm sexy ebonies] [http://davte.info/library/html/orienta-giovani.htm orienta giovani] [http://amohseni.info/img/styles/christmas-sexi/ christmas sexi] [http://amohseni.info/img/styles/baktay-ervin/ baktay, ervin] [http://ashythro.info/library/html/noche-de/ noche de ronda] [http://davte.info/library/html/ssteb.htm ssteb] [http://bloprofeldi.info/lib/orologio-philip.htm orologio philip watch] [http://amohseni.info/img/styles/mr-moto/ mr. moto va in vacanza] [http://saibso.org/culo-aperti.htm culo aperti] [http://davte.info/library/html/hard-disk.htm hard disk con display] [http://ustall.org/web/sexy-bar.htm sexy bar bambola] [http://davte.info/library/html/rosh-zohar.htm rosh zohar] [http://davte.info/library/html/eagle-pack.htm eagle pack] [http://helmed.info/topic/a-s/ a s sora] [http://helmed.info/topic/cover-nair/ cover nair] [http://kinunia.cn/canon-ack.htm canon ack800] [http://chaba.info/philips-televisori/ philips televisori plasma pixel plus] [http://amohseni.info/img/styles/paolo-villaggio/ paolo villaggio. box set] [http://saibso.org/ipod-nano.htm ipod nano mp3] [http://saibso.org/hard-disk.htm hard disk 2 5 5400] [http://amohseni.info/img/styles/hotel-di/ hotel di pescara] [http://helmed.info/topic/hoover-floormate/ hoover floormate] [http://helmed.info/topic/www-il/ www il gazzetta ufficiale it] [http://amohseni.info/img/styles/come-ti/ come ti collego la console...] [http://amohseni.info/img/styles/ed-eddy/ ed eddy edd] [http://bloprofeldi.info/lib/kit-home.htm kit home cinema] [http://psisemiya.com/images/small/negozi-hi/ negozi hi fi san marino] [http://chaba.info/noleggio-jeep/ noleggio jeep] [http://bloprofeldi.info/lib/duncan-adam.htm duncan, adam] [http://chaba.info/metodo-del/ metodo del costo di riproduzione valutaz] [http://davte.info/library/html/telefonico.htm telefonico] [http://ashythro.info/library/html/lettori-di/ lettori di memory card] [http://ustall.org/web/terza-prova.htm terza prova esame di stato 2004] [http://davte.info/library/html/cristina-grillo.htm cristina grillo sex] [http://helmed.info/topic/star-trek/ star trek enterprise] [http://helmed.info/topic/i-mate/ i mate pda2] [http://davte.info/library/html/giocattoli-batman.htm giocattoli batman] [http://bloprofeldi.info/lib/impuntura.htm impuntura] [http://ashythro.info/library/html/giochi-perversi/ giochi perversi di una signora bene] [http://saibso.org/mammamia.htm mammamia] [http://psisemiya.com/images/small/soa-srl/ soa srl] [http://ashythro.info/library/html/foto-lee/ foto lee ryan dei blue] [http://helmed.info/topic/gochi-di/ gochi di paura] {{task}}
{{task}}


==[[C]]==
==[[C]]==
Line 35: Line 35:
}
}


==[[C plus plus|C++]]==
==[[C plus plus|C ]]==
[[Category:C plus plus]]
[[Category:C plus plus]]
===[[Qt]] 4===
===[[Qt]] 4===
Line 58: Line 58:
[[Category:Gtk]]
[[Category:Gtk]]


'''Compiler command:''' g++ filename.cc -o test `pkg-config --cflags --libs gtkmm-2.4`
'''Compiler command:''' g filename.cc -o test `pkg-config --cflags --libs gtkmm-2.4`


#include <iostream>
#include <iostream>
Line 73: Line 73:
}
}
catch( std::exception const & exc )
catch( std::exception const
{
std::cout << exc.what() << std::endl ;
exit( -1 ) ;
}
exit( 0 ) ;
}

==[[C sharp|C#]]==
[[Category:C sharp]]
'''Platform:''' [[.NET]] 1.1 (or higher)

'''Compiler:''' [[Visual C sharp|Visual C#]] 2003

'''Using:''' [[System.Windows.Forms.dll]]

using System;
using System.Windows.Forms;
public class Window
{
[STAThread]
static void Main()
{
Form newForm = new Form();
newForm.Text = "It's a new Window!";
newForm.Show();
}
}

==[[E]]==
[[Category:E]]

===Java AWT/Swing===

'''Implementation:''' E-on-Java

when (currentVat.morphInto("awt")) -> {
def w := <swing:makeJFrame>("Window")
w.setContentPane(<swing:makeJLabel>("Contents"))
w.pack()
w.show()
}

==[[IDL]]==
[[Category:IDL]]

With some example values filled in:

Id = WIDGET_BASE(TITLE='Window Title',xsize=200,ysize=100)
WIDGET_CONTROL, /REALIZE, id


==[[Java]]==
[[Category:Java]]

'''Library:''' [[Swing]]

[[Category:Swing]]

import javax.swing.JFrame;
import javax.swing.WindowConstants;
public class SimpleWindow {
public static void main(String[] args) {
JFrame window = new JFrame("This is a title!");
window.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
window.setSize(800, 600);
window.setVisible(true);
}
}

==[[JavaScript]]==
[[Category:JavaScript]]
window.open("webpage.html", "windowname", "width=800,height=600");

==[[mIRC Scripting Language]]==
[[Category:mIRC Scripting Language]]

'''Interpreter:''' [[mIRC]]
'''Switches:'''
C = Center Window
p = Picture Window
d = Desktop Window

alias CreateMyWindow {
.window -Cp +d @WindowName 600 480
}

==[[Perl]]==
[[Category:Perl]]

'''Interpreter:''' [[Perl]] 5.8.8

Using [[Tk]]:

use Tk;
$mw = MainWindow->new();
MainLoop;

==[[Python]]==
[[Category:Python]]

'''Interpreter:''' [[Python]] 2.4, 2.5

===[[Tkinter]]===

[[Category:Tkinter]]

import Tkinter
w = tkinter.Tk()
w.mainloop()

===[[wxPython]]===

[[Category:wxPython]]

from wxPython.wx import *
class MyApp(wxApp):
def OnInit(self):
frame = wxFrame(NULL, -1, "Hello from wxPython")
frame.Show(true)
self.SetTopWindow(frame)
return true
app = MyApp(0)
app.MainLoop()

===[[Pythonwin]]===

[[Category:Pythonwin]]

import win32ui
from pywin.mfc.dialog import Dialog
d = Dialog(win32ui.IDD_SIMPLE_INPUT)
d.CreateWindow()

===[[PyGTK]]===

[[Category:PyGTK]]

import gtk
window = gtk.Window()
window.show()
gtk.main()

==[[Ruby]]==
[[Category:Ruby]]

'''Interpreter:''' [[Ruby]] 1.8.5

===[[Tk]]===

[[Category:Tk]]

require 'tk'
window = TkRoot::new()
window::mainloop()

===[[GTK]]===
require 'gtk2'
window = Gtk::Window.new.show
Gtk.main

==[[RapidQ]]==
[[Category:RapidQ]]

create form as qform
center
width=500
height=400
end create
form.showModal

==[[Tcl]]==
[[Category:Tk]]

Loading the "Tk" package is all that is required to get an initial window:

package require Tk

If you need an additional window:

toplevel .top

If you are using the increasingly popular [http://www.equi4.com/tclkit.html tclkit] under MS Windows, all you have to do is associate the tcklkit with the extension ".tcl" and then create an <i>empty</i> file with the name (e.g.) <tt>nothing.tcl</tt>. Douple-clicking that will "open a window" (an empty one).

==[[Toka]]==
[[Category:Toka]]

'''Library:''' [[SDL]]
[[Category:SDL]]

Toka does not inherently know about graphical environments, but can interact with
them using external libraries. This example makes use of the [[SDL]] library bindings
included with Toka.

needs sdl
needs case

sdl_event_size malloc is-data event
800 600 sdl_setup drop

#! Process events, exiting when the window is closed
[
event SDL_WaitEvent drop

event sdl_event_type switch
SDL_QUIT [ bye ] case

TRUE
] keep whileTrue

==[[Visual Basic .NET]]==
[[Category:Visual Basic .NET]]

Framework: [[.NET]]
Dim newForm as new Form
newForm.Text = "It's a new window"
newForm.Show()

Revision as of 04:41, 18 August 2007

code satellite tps usl feltre cooper, gordon leroy ivan delphi big bolls multifunzione fax canon cavo hard disk golf 1 9 tdi comfortline nuova golosa king africa partido en vivo de los tiburones berluska i t c beltrami forza venite la girandola snc partita mondiale calcio lynyrd skynyrd bigliettini per la prima comunione integratori fibre auto frog sumo jessica pare ixus 50 canon edyta bartosiewicz krawczyk trudno tak francesca neri diffusori 7 1 sabbatucci e vidotto famosas desnudas deportistas c s computer software srl gazzetta sport palmare occasione lg lcd rz-37lz30 lirik lagu melayu emozion iomega hard disk drive s s c n sodimm 256mb ddr 333mhz pc2700 yamaha xt revamped per fare quiz patentino rs-mmc 512 dual voltage 6630 cf card gprs lettori dvd e divx pioneer rikki pure heart disegno sul muro spa zoom 6x la sorella di bruce lee macchine truccate adidas mei hp nx 6110 p-m 740 midnight hour pickett shantung instant portami lontano www disnay televisore 29 100hz lettori dvd vcd jpeg km0 fiat multipla benzina auto km 0 www providian com giovanni marchese to this love la oreja de van zucchero fornaciari zuccherifici syncback pcgratis ozon ochi tai dove rifarsi il seno cavo rca minijack emmanuil, cesare mercedes serie ml roma sito beni culturali bova ultimo cunha, euclydes da- supratutto asrock 939s56-m hamlet dvb transfert portal polti vaporetto eco pro 3000 profumi uomo herrera jewel lyrics spirit victoria gemme snc marron five this love testo bikini micro accademia di danza di montecarlo prince of persia gioco enriko canzone amicizia www cupa it pigiama uomo favola di pinocchio mode sector terratec t2 usb 2 0 dvb-t boblbobl abile rennie, john fiat cinquecento happy hour la pantera rossa www google copm casse acustiche mini export manager (regione lombardia - milano provincia) iomega portable hard disk giro d italia 2001 casio z40 ristoranti caserta hotel ad amsterdam star sailor jeep grand cherokee 2002 pc transfer nec 313 diciotto scandalo blaze tunisia hotel lisola sconosciuta coltello offerte pc alessia merz merz nuda jura 385 langelo del ring spugne di mare da rgb a component notre dame des paris i case ipod test drive off-road 3 ci vediamo marco masini rx v450 cerca lassassino trailer selen mpg free www fitnessring it trama nozze di figaro abbinare colori uguali big angel sigla telefilm buffy festa arma carabiniere lisola che scotta giorgio stefy visitare l abruzzo spinaci nuova espansione per anarchy online ml 2250 toner prostitutas com le avventure di tarzan emanuela nay alfa romeo gtv una donna due passioni ita integrated technology automation suites per violoncello di bach nomadi mediterraneo gommapiuma materassi festivalbar blue 2004 oraziano server news libero siemens s645 gigaset urbis midi sslazio donnald it agriturismo sorrento sexy ebonies orienta giovani christmas sexi baktay, ervin noche de ronda ssteb orologio philip watch mr. moto va in vacanza culo aperti hard disk con display sexy bar bambola rosh zohar eagle pack a s sora cover nair canon ack800 philips televisori plasma pixel plus paolo villaggio. box set ipod nano mp3 hard disk 2 5 5400 hotel di pescara hoover floormate www il gazzetta ufficiale it come ti collego la console... ed eddy edd kit home cinema negozi hi fi san marino noleggio jeep duncan, adam metodo del costo di riproduzione valutaz telefonico lettori di memory card terza prova esame di stato 2004 cristina grillo sex star trek enterprise i mate pda2 giocattoli batman impuntura giochi perversi di una signora bene mammamia soa srl foto lee ryan dei blue gochi di paura

Task
Window creation
You are encouraged to solve this task according to the task description, using any language you may know.

C

Standard: ANSI C (AKA C89):

Compiler: GCC 4.0.3

Library: SDL

Compile Command: gcc -lSDL SDL_Window.c -o window

/*
 *   Opens an 800x600 16bit color window. 
 *   Done here with ANSI C.
 */

#include <stdio.h>
#include <stdlib.h>
#include "SDL/SDL.h"

main(){

SDL_Surface *screen;

if (SDL_Init(SDL_INIT_VIDEO) != 0) {
  fprintf(stderr, "Unable to initialize SDL: %s\n", SDL_GetError());
  return(1);
}
atexit(SDL_Quit);
screen = SDL_SetVideoMode( 800, 600, 16, SDL_SWSURFACE | SDL_HWPALETTE );
}

C

Qt 4

Compiler command: qmake -pro; qmake

#include <QApplication>
#include <QMainWindow>

int main(int argc, char *argv[])
{
 QApplication app(argc, argv);
 QMainWindow window;
 window.show();
 return app.exec();
}

Gtk

Compiler command: g filename.cc -o test `pkg-config --cflags --libs gtkmm-2.4`

#include <iostream>
#include <gtkmm.h>

int
main( int argc, char* argv[] )
{
 try
 {
  Gtk::Main m( argc, argv ) ;
  Gtk::Window win ;
  m.run( win ) ;
 }
 
 catch( std::exception const