PtQueryCallbacks

PtQueryCallbacks — finds widget callback functions.

Syntax

PtQueryCallbacks (widget, callback_number)

		

Arguments

widget

Any widget.

callback_number

A callback-number or symbol equating to a callback-number.

Returns

A list of all functions associated with the callback.

Example

This example, ex_PtQueryCallbacks.g, is included in the product distribution.

#!/usr/cogent/bin/phgamma

/*
This code puts up a window with a button.  Pressing the button creates
two text boxes.  The second box displays the return value of the
PtQueryCallbacks() call. Also, each time the button is pressed, the
return value is printed.
*/

require_lisp("PhotonWidgets");
PtInit(nil);

win = new(PtWindow);
win.SetDim(200,200);
PtRealizeWidget(win);

button = new(PtButton);
button.text_string = "Press Here.";
button.SetPos(60,20);
PtAttachCallback(button, Pt_CB_ACTIVATE, #title());
PtAttachCallback(button, Pt_CB_ACTIVATE, #functionlist());
PtRealizeWidget(button);

function title()
{
	txt = new(PtText);
	txt.SetPos(30,80);
	txt.SetDim(150,25);
	a = PtQueryCallbacks(button, Pt_CB_ACTIVATE);
	txt.text_string = string("The callback functions:");
	PtRealizeWidget(txt);
}

function functionlist()
{
	txt = new(PtText);
	txt.SetPos(30,115);
	txt.SetDim(150,25);
	c = PtQueryCallbacks(button, Pt_CB_ACTIVATE);
	txt.text_string = string(c);
	princ(c,"\n");
	PtRealizeWidget(txt);
}

PtMainLoop();