Print a Widget Tree Summary

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

# 4.12. Print a Widget Tree Summary

    #!/usr/cogent/bin/phgamma

    /*
     * This example reads a widget file and prints the widget level,
     * type, and name in hierarchical order. You can use the test file
     * WidgetFiles/wgt/colortest.wgtw by entering its name as the first
     * argument on the command line.
     */

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

    /*
     * Read the widget definitions, and access them.
     */
    file = string(cadr(argv));
    defs = PhabReadWidgetFile(file);
    treewin = car(defs);

    /*
     * Make a function that walks a widget tree, and finds
     * and prints the level, name, and type of its widgets.
     */
    function PhabInfoTree(tree)
      {
        local return = nil;
        local trees;
        if (car(tree))
    	   princ(caar(tree)," ",cadar(tree),"\t\t ",caddr(car(tree)),"\n");
        for (trees = cdr(tree); trees; trees = cdr(trees)){
    	   return = PhabInfoTree(car(trees));
    	 }
        return;
      }

    /*
     * Call the function.
     */
    PhabInfoTree(treewin);

Prev | Home | Next
Select and Recreate Any Widget | Up | Integrating with Cogent Software

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