In PtText the Pt_CB_ARM and Pt_CB_ACTIVATE work as expected after you enable Pt_SELECTABLE in Pt_ARG_FLAGS. Please read the documentation again.
I still do not understand what is steven_lougheed trying to acomplish.
Maybe the focus callbacks would suit him better.
Anyway, here is a simple example on Pt_CB_ARM and Pt_CB_ACTIVATE
#include <Pt.h>
void cb_activate (PtWidget_t *wgt, void *user_data, PtCallbackInfo_t *info)
{
const char *str;
str = user_data;
printf("%s %s\n", str, "Pt_CB_ACTIVATE");
}
void cb_arm (PtWidget_t *wgt, void *user_data, PtCallbackInfo_t *info)
{
const char *str;
str = user_data;
printf("%s %s\n", str, "Pt_CB_ARM");
}
int main (int argc, char *argv [])
{
PtAppContext_t app;
PhDim_t dim;
PhPoint_t pos;
PtWidget_t *window, *text, *text2;
PtArg_t args [3];
int nargs;
dim.w = 120;
dim.h = 80;
nargs = 0;
PtSetArg(&args[nargs++], Pt_ARG_DIM, &dim, 0);
if ((window = PtAppInit(&app, &argc, argv, nargs, args)) == NULL)
return -1;
dim.w = 100;
dim.h = 20;
pos.x = 5;
pos.y = 5;
nargs = 0;
PtSetArg(&args[nargs++], Pt_ARG_DIM, &dim, 0);
PtSetArg(&args[nargs++], Pt_ARG_POS, &pos, 0);
PtSetArg(&args[nargs++], Pt_ARG_FLAGS, Pt_TRUE, Pt_SELECTABLE);
if ((text = PtCreateWidget(PtText, window, nargs, args)) == NULL)
return -1;
dim.w = 100;
dim.h = 20;
pos.x = 5;
pos.y = 30;
nargs = 0;
PtSetArg(&args[nargs++], Pt_ARG_DIM, &dim, 0);
PtSetArg(&args[nargs++], Pt_ARG_POS, &pos, 0);
PtSetArg(&args[nargs++], Pt_ARG_FLAGS, Pt_TRUE, Pt_SELECTABLE);
if ((text2 = PtCreateWidget(PtText, window, nargs, args)) == NULL)
return -1;
PtAddCallback(text, Pt_CB_ACTIVATE, cb_activate, "text");
PtAddCallback(text, Pt_CB_ARM, cb_arm, "text");
PtAddCallback(text2, Pt_CB_ACTIVATE, cb_activate, "text2");
PtAddCallback(text2, Pt_CB_ARM, cb_arm, "text2");
PtRealizeWidget(window);
PtMainLoop();
return 0;
}