Здесь рассмотрены слоты для простейшего использования кнопок и текстовых меток. Если нажимать на "pushButton2", число кликов будет отображаться на "textLabel1". Если нажимать на "pushButton1", то будет вызываться mask1, т.к. программа возвратится к циклу в "pvMain".
typedef struct // (todo: define your data structure here)
{
int click; // number of clicks
}
DATA;
static int slotInit(PARAM *p, DATA *d)
{
if(p == NULL || d == NULL) return -1;
memset(d,0,sizeof(DATA));
return 0;
}
static int slotButtonEvent(PARAM *p, int id, DATA *d)
{
if(p == NULL || id == 0 || d == NULL) return -1;
if(id == pushButton1)
{
return 1; // call mask 1
}
if(id == pushButton2)
{
pvPrintf(p,textLabel1,"click %d",d->click++);
}
return 0;
}