Project

General

Profile

Hello world » History » Revision 7

Revision 6 (iri, 02/22/2011 02:26 PM) → Revision 7/8 (iri, 02/22/2011 02:27 PM)

h1. Hello world 

 Here is a famous "Hello world" ! 

 <pre><code class="php"> 
 typeof win = ObjGtkWidget;; 
 typeof button = ObjGtkWidget;; 

 fun CBend (obj, uparam)= 
     /* Stop the GTK+ loop */ 
     _gtkMainQuit; 
     _closemachine; 
     0;; 

 fun CBbutton (obj, uparam)= 
     _fooS strcat "user param is : " uparam; 
     0;; 

 fun main ()= 
     /* display the console */ 
     _showconsole; 

     /* create a window */ 
     set win = _gtkWindowNew _channel nil "First example" [320 50] [500 400]; 
     /* define acallback when the window will be destroyed */ 
     _gtkWindowCBdestroyed win @CBend 0; 

     /* create a button with a simple label */ 
     set button = _gtkButtonNew _channel "Hello World !" SCOL_GTK_BUTTON_LABEL nil; 
     /* define a callback when the button will be clicked */ 
     _gtkButtonCB _gtkButtonCBclicked button @CBbutton "It's great !" SCOL_GTK_BUTTON_CB_CLICKED; !"; 

     /* Add the button to the window */ 
     _gtkWindowAddChild win button; 
     /* Show all */ 
     _gtkWidgetShowAll win; 
     /* Run the GTK+ loop */ 
     _gtkMain; 
     0;;    
 </code></pre> 

 Return [[Examples]]