PhGetRects (event)
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.
This example, ex_PhGetRects.g, is included in the product distribution.
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)})})
Copyright © 1995-2010 by Cogent Real-Time Systems, Inc. All rights reserved.