Why PtUnrealizeWidget/PtRealizeWidget do not remove , return text from the
display?
Janusz Ruszel.
#include <stdio.h>
#include <Pt.h>
#include <sys/neutrino.h>
PhArea_t area = { {0, 0}, {200,40} };
PtWidget_t *window;
PtWidget_t *txt;
PhPoint_t pos = {-100,-100};
void *
slowThread( void*)
{
while (true)
{
PtEnter(0);
PtUnrealizeWidget(txt);
sleep(3);
PtRealizeWidget(txt);
PtLeave(0);
sleep(3);
printf(“run\n”);
}
}
main(int argc, char *argv[])
{
PtAppContext_t app;
int nargs = 0;
PtArg_t args[4];
if (PtInit(NULL) == -1)
PtExit(EXIT_FAILURE);
PtSetArg(&args[nargs++], Pt_ARG_POS, &area.pos, 0);
PtSetArg(&args[nargs++], Pt_ARG_DIM, &area.size,
0);
PtSetArg(&args[nargs++], Pt_ARG_WINDOW_TITLE,
“hello”, 0);
if ((window = PtCreateWidget(PtWindow,
Pt_NO_PARENT,
nargs, args)) == NULL)
PtExit(EXIT_FAILURE);
nargs = 0;
area.pos.y = 15;
PtSetArg(&args[nargs++], Pt_ARG_POS, &area.pos, 0);
PtSetArg(&args[nargs++], Pt_ARG_DIM, &area.size,
0);
PtSetArg(&args[nargs++], Pt_ARG_TEXT_STRING,
“hello, world…”, 0);
txt = PtCreateWidget(PtText, window, nargs, args);
PtRealizeWidget(window);
ThreadCreate(
0,
slowThread,
NULL,
NULL );
PtMainLoop();
}