PhGetRects

Gamma/Photon: Using Gamma™ with the Photon microGUIŽ, Version 4.0
Prev |  | Next

# `PhGetRects`

`PhGetRects` -- gets rectangle sets.

## Syntax

    PhGetRects (event)

## Arguments

`event`

  An instance of the PhEvent class.

## Returns

The rectangle associated with the `event`.

## Description

This function returns two corner points that define a rectangle set associated with the `event`. The output is a list containing a single instance of the `PhRect` class. The `PhRect` class has two members, the upper left corner (ul) and lower right corner (lr). Each of these members contains a dotted list of the name (ul or lr) and instances of the `PhPoint` class.

## Example

This example, `ex_PhGetRects.g`, is included in the `gamma_ph_`#`_examples_1_QNX4.tgz` file available on the Cogent Web Site.

Running the following code:

    #!/usr/cogent/bin/phgamma

    /*
    This example prints the location of the mouse pointer when the mouse
    button is clicked or the mouse moves. The rectangle is a single point,
    so the upper left corner of the rectangle is equal to the lower right
    corner.
    */

    PtInit(nil);

    win = new(PtWindow);
    PtRealizeWidget(win);

    function cb_function ()
    {
        princ(PhGetRects(cbinfo.event),"\n");
    }

    PtAttachCallback(win,Pt_CB_RAW,#cb_function());

    PtMainLoop();

produces the following kind of output.

        ({PhRect (lr . {PhPoint (x . 64) (y . 42)}) (ul . {PhPoint (x . 64) (y . 42)})})

## See Also

In Photon documentation: PhRect.

Prev | Home | Next
Photon Functions | Up | `PhEmitEvent`

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