PtRemoveCallback

PtRemoveCallback — removes a callback.

Syntax

PtRemoveCallback (widget, callback_number, function)

		

Arguments

widget

The widget to remove the callback function from.

callback_number

The callback type.

function

The function to remove.

Returns

t when successful.

Example

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

#!/usr/cogent/bin/phgamma

/*
This example attaches a callback to a button to start pfm (Photon File
Manager).  After 10 seconds the callback is removed and the text on
the face of the button is changed.
*/

function start_pfm ()
{
   system("pfm &");
}

function remove_callback (button)
{
   button.text_string = "I no longer start PFM";
   PtRemoveCallback(but,Pt_CB_ACTIVATE,code);
}

PtInit(nil);
win = new(PtWindow);
but = new(PtButton);
but.text_string = "Press Me to Start PFM";
PtRealizeWidget(win);

code = #start_pfm();

PtAttachCallback(but,Pt_CB_ACTIVATE,code);
after(10,#remove_callback(but));

PtMainLoop();


See Also

PtAttachCallback