### 2.2.1 Example 1, Hello World

Listed below is a simple "Hello World" program. It demonstrates the seven steps outlined above for writting an EZwgl application. When run, this program displays a toplevel push button labeled "Hello World". If the widget window is resized, the position of the lable will be adjusted accordingly. If you press the left mouse button (Button1) over the widget window, it quits.

    /************************** Example 1 *********************************/
    #include "EZ.h"                               /* the header file      */

    void cleanExit(EZ_Widget *widget, void *dat)  /* push button callback */
    {
      EZ_Shutdown();/* shutdown EZWGL */
      exit(0);      /* and exit       */
    }

    main(int argc, char **argv)
    {
      EZ_Widget *hello;

      EZ_Initialize(argc,argv,0);       /* initialize EZWGL    */

              /* create a button and set its foreground red    */
      hello = EZ_CreateWidget(EZ_WIDGET_NORMAL_BUTTON, NULL,
                              EZ_LABEL_STRING, "Hello World",
                              EZ_FOREGROUND, "red",
                              0);

      EZ_AddWidgetCallBack(hello,       /* register call back  */
            EZ_CALLBACK, cleanExit, NULL, 0);

      EZ_DisplayWidget(hello);          /* show the button     */

      EZ_EventMainLoop();               /* handle mouse inputs */
    }
    /************************** Example 1 *********************************/

Note: All example programs in this document are in the examples subdirectory of the EZwgl distribution.

HTML Documentation Maintainance:`Arturo Espinosa <arturo@nuclecu.unam.mx>`