The widget to remove the callback function from.
The callback type.
The function to remove.
This example, ex_PtRemoveCallback.g, is included in the gamma_ph_#_examples_1_QNX4.tgz file available on the Cogent Web Site.
#!/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();