Load a Window Created in PhAB

Gamma/Photon: Using Gamma™ with the Photon microGUIŽ, Version 4.0
Prev | Chapter 4. Building Applications - a Tutorial | Next

# 4.4. Load a Window Created in PhAB

    #!/usr/cogent/bin/phgamma

    /* This example is the first of three ways to incorporate a
     * PhAB-created GUI into a Gamma program.  It loads from PhAB a window
     * similar to the one created in the last example, and attaches
     * callbacks to the widgets.  This illustrates an advantage of using
     * Gamma and PhAB together.  Complex widgets can be created and
     * changed quickly in PhAB, while callbacks and other code can be
     * attached easily in Gamma.*/

    require_lisp("PhotonWidgets.lsp");
    require_lisp("PhabTemplate.lsp");
    PtInit(nil);

    /*
     * Load the window that was previously created in PhAB.
     */
    PhabLoad ("WidgetFiles/wgt/colortest.wgtw");

    /*
     * Attach callbacks.
     */
    PtAttachCallback(entrybox,Pt_CB_TEXT_CHANGED,
                     #entry = parse_string(entrybox.text_string));
    PtAttachCallback(entrybox,Pt_CB_ACTIVATE,#pane.fill_color = entry);
    PtAttachCallback(but,Pt_CB_ACTIVATE,#exit_program(-1));

    PtRealizeWidget(colortest);
    PtMainLoop();

Prev | Home | Next
Add Functionality with Callbacks | Up | Read a Widget File and Create its Widgets

Copyright 1995-2002 by Cogent Real-Time Systems, Inc.