PtAskQuestion vs. Pt_CB_SELECTION in PtList

Hi,

I have the following problem:

Suppose you have the main window named “base”. In this window you have
one PtList widget (e.g. with 3 items) named “base_list”.
“base_list” has all the resources default (e.g. Pt_BROWSE_MODE, …)
and only one code callback:


//******************************************
/* Standard headers */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>

/* Toolkit headers */
#include <Ph.h>
#include <Pt.h>
#include <Ap.h>

/* Local headers */
#include “abimport.h”
#include “proto.h”


int
base_list_selection( PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo )

{

/* eliminate ‘unreferenced’ warnings */
widget = widget, apinfo = apinfo, cbinfo = cbinfo;

if (cbinfo->reason_subtype == Pt_LIST_SELECTION_BROWSE) {

PtAskQuestion( ABW_base_list, NULL,
“hello”,
“arials10”,
“msgyes”,
“msgno”,
NULL, 1);
}

return( Pt_CONTINUE );

}

//******************************************

It’s very simple but I have the problem with it:

If the selected item is for example the first item and I click another item,
the message appears, I click yes/no, message disapears, AND THEN I CLICK
OUTSIDE THE PtList WHICH CAUSE THE RE-SELECTION TO PREVIOUS ITEM.

Please, how to fix it?

Vladislav Mikula

Hi Vladislav,

Thank you for pointing this out to us. It is a bug.
A work around for this is to change your test to
look for Pt_LIST_SELECTION_FINAL. For example


if (cbinfo->reason_subtype == Pt_LIST_SELECTION_FINAL)
{

PtAskQuestion( ABW_base_list, NULL,
“hello”,
“arials10”,
“msgyes”,
“msgno”,
NULL, 1);
}

Hope this helps
Regards
Brenda


Vladislav Mikula <vladom@nod10.mstep> wrote:

Hi,

I have the following problem:

Suppose you have the main window named “base”. In this window you have
one PtList widget (e.g. with 3 items) named “base_list”.
“base_list” has all the resources default (e.g. Pt_BROWSE_MODE, …)
and only one code callback:

//******************************************
/* Standard headers */
#include <stdio.h
#include <stdlib.h
#include <unistd.h
#include <string.h

/* Toolkit headers */
#include <Ph.h
#include <Pt.h
#include <Ap.h

/* Local headers */
#include “abimport.h”
#include “proto.h”



int
base_list_selection( PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo )

{

/* eliminate ‘unreferenced’ warnings */
widget = widget, apinfo = apinfo, cbinfo = cbinfo;

if (cbinfo->reason_subtype == Pt_LIST_SELECTION_BROWSE) {

PtAskQuestion( ABW_base_list, NULL,

“hello”,
“arials10”,
“msgyes”,
“msgno”,
NULL, 1);
}

return( Pt_CONTINUE );

}

//******************************************

It’s very simple but I have the problem with it:

If the selected item is for example the first item and I click another item,
the message appears, I click yes/no, message disapears, AND THEN I CLICK
OUTSIDE THE PtList WHICH CAUSE THE RE-SELECTION TO PREVIOUS ITEM.

Please, how to fix it?

Vladislav Mikula