PtList

Hi,
I am using a PtList widget in my program and adding some strings to the list
using the PtListAddItems() function. The selection mode(Pt_ARG_SEL_MODE) for
the list is the Browse mode and I have defined a Pt_CB_SELECTION callback
where I keep track of the item_count and item_postion. The first time I
display the items it invokes this callback. But if I delete all the items
and call the PtListAddItems() with a different set of strings it fails to
invoke the callback until I hit the Up/Down keys.
Your help is appreciated.

Thank you,
Shashank

Hello.

You might want to take a look at the Pt_ARG_FLAGS bit called
Pt_CALLBACKS_ACTIVE. Generically speaking, this makes callbacks active if a
widget’s value has been manipulated in code. Specifically speaking, if you
set this bit and then select an item from code, it will invoke the callback.
So, when you add the new items after deleting all of the previous ones, you
could call PtListSelectPos() to select the first item and thus invoke your
callback ( given that the Pt_CALLBACKS_ACTIVE bit is set ).

Regards.

Rodney Lott

“Shashank” <sbalijepalli@precitech.com> wrote in message
news:aqtj2l$45n$1@inn.qnx.com

Hi,
I am using a PtList widget in my program and adding some strings to the
list
using the PtListAddItems() function. The selection mode(Pt_ARG_SEL_MODE)
for
the list is the Browse mode and I have defined a Pt_CB_SELECTION callback
where I keep track of the item_count and item_postion. The first time I
display the items it invokes this callback. But if I delete all the items
and call the PtListAddItems() with a different set of strings it fails to
invoke the callback until I hit the Up/Down keys.
Your help is appreciated.

Thank you,
Shashank

Hello,
I set the Pt_CALLBACKS_ACTIVE bit. But it still doesn’t work. Any clues??

Shashank

“Rodney Lott” <rlott@fct.ca> wrote in message
news:aqtkab$5do$1@inn.qnx.com

Hello.

You might want to take a look at the Pt_ARG_FLAGS bit called
Pt_CALLBACKS_ACTIVE. Generically speaking, this makes callbacks active if
a
widget’s value has been manipulated in code. Specifically speaking, if
you
set this bit and then select an item from code, it will invoke the
callback.
So, when you add the new items after deleting all of the previous ones,
you
could call PtListSelectPos() to select the first item and thus invoke your
callback ( given that the Pt_CALLBACKS_ACTIVE bit is set ).

Regards.

Rodney Lott

“Shashank” <> sbalijepalli@precitech.com> > wrote in message
news:aqtj2l$45n$> 1@inn.qnx.com> …
Hi,
I am using a PtList widget in my program and adding some strings to the
list
using the PtListAddItems() function. The selection mode(Pt_ARG_SEL_MODE)
for
the list is the Browse mode and I have defined a Pt_CB_SELECTION
callback
where I keep track of the item_count and item_postion. The first time I
display the items it invokes this callback. But if I delete all the
items
and call the PtListAddItems() with a different set of strings it fails
to
invoke the callback until I hit the Up/Down keys.
Your help is appreciated.

Thank you,
Shashank
\

Shashank <sbalijepalli@precitech.com> wrote:

I set the Pt_CALLBACKS_ACTIVE bit. But it still doesn’t work. Any clues??

This has nothing to do with the Pt_CALLBACKS_ACTIVE bit. The
Pt_CALLBACKS_ACTIVE bit does not affect the Pt_CB_SELECTION callback.
Only callbacks whose docs specifically mention Pt_CALLBACKS_ACTIVE are
affected by Pt_CALLBACKS_ACTIVE. (Unless, of course, we have forgotten
to document some cases…)

What’s happening in your program is that when the widget gets focus, it
automatically selects the current item (unless, of course, there are no
items in the widget – that’s why you’re not getting the callback when
the list is empty). This behaviour can be disabled by setting
Pt_SELECTION_MODE_NOFOCUS – check the docs for Pt_ARG_SELECTION_MODE
for details.




Shashank

“Rodney Lott” <> rlott@fct.ca> > wrote in message
news:aqtkab$5do$> 1@inn.qnx.com> …
Hello.

You might want to take a look at the Pt_ARG_FLAGS bit called
Pt_CALLBACKS_ACTIVE. Generically speaking, this makes callbacks active if
a
widget’s value has been manipulated in code. Specifically speaking, if
you
set this bit and then select an item from code, it will invoke the
callback.
So, when you add the new items after deleting all of the previous ones,
you
could call PtListSelectPos() to select the first item and thus invoke your
callback ( given that the Pt_CALLBACKS_ACTIVE bit is set ).

Regards.

Rodney Lott

“Shashank” <> sbalijepalli@precitech.com> > wrote in message
news:aqtj2l$45n$> 1@inn.qnx.com> …
Hi,
I am using a PtList widget in my program and adding some strings to the
list
using the PtListAddItems() function. The selection mode(Pt_ARG_SEL_MODE)
for
the list is the Browse mode and I have defined a Pt_CB_SELECTION
callback
where I keep track of the item_count and item_postion. The first time I
display the items it invokes this callback. But if I delete all the
items
and call the PtListAddItems() with a different set of strings it fails
to
invoke the callback until I hit the Up/Down keys.
Your help is appreciated.

Thank you,
Shashank

\


Wojtek Lerch QNX Software Systems Ltd.

Rodney Lott <rlott@fct.ca> wrote:

You might want to take a look at the Pt_ARG_FLAGS bit called
Pt_CALLBACKS_ACTIVE. Generically speaking, this makes callbacks active if a
widget’s value has been manipulated in code. Specifically speaking, if you
set this bit and then select an item from code, it will invoke the callback.

No it won’t. The Pt_CALLBACKS_ACTIVE flag only affect certain
callbacks, and all those cases are documented. This is how it’s
explained in the docs:

Pt_CALLBACKS_ACTIVE

If certain widgets have this bit set, and your application sets
their resources, the relevant callbacks are invoked. Otherwise
callbacks aren’t invoked when your application sets resources. If a
callback refers to this flag, its description says so explicitly.

Notice that the documentation of Pt_CB_SELECTION does not mention
Pt_CALLBACKS_ACTIVE.


Wojtek Lerch QNX Software Systems Ltd.

And, you have called PtListSelectPos() to select the first element after
repopulating the list?

Rodney.

“Shashank” <sbalijepalli@precitech.com> wrote in message
news:aqtvrh$ilq$1@inn.qnx.com

Hello,
I set the Pt_CALLBACKS_ACTIVE bit. But it still doesn’t work. Any clues??

Shashank

“Rodney Lott” <> rlott@fct.ca> > wrote in message
news:aqtkab$5do$> 1@inn.qnx.com> …
Hello.

You might want to take a look at the Pt_ARG_FLAGS bit called
Pt_CALLBACKS_ACTIVE. Generically speaking, this makes callbacks active
if
a
widget’s value has been manipulated in code. Specifically speaking, if
you
set this bit and then select an item from code, it will invoke the
callback.
So, when you add the new items after deleting all of the previous ones,
you
could call PtListSelectPos() to select the first item and thus invoke
your
callback ( given that the Pt_CALLBACKS_ACTIVE bit is set ).

Regards.

Rodney Lott

“Shashank” <> sbalijepalli@precitech.com> > wrote in message
news:aqtj2l$45n$> 1@inn.qnx.com> …
Hi,
I am using a PtList widget in my program and adding some strings to
the
list
using the PtListAddItems() function. The selection
mode(Pt_ARG_SEL_MODE)
for
the list is the Browse mode and I have defined a Pt_CB_SELECTION
callback
where I keep track of the item_count and item_postion. The first time
I
display the items it invokes this callback. But if I delete all the
items
and call the PtListAddItems() with a different set of strings it fails
to
invoke the callback until I hit the Up/Down keys.
Your help is appreciated.

Thank you,
Shashank


\

Hi, Wojtek.

Thanks for the clarification. I guess I didn’t read the part closely enough
regarding the
“explicit” mention. D’oh!

Regards.

Rodney

“Wojtek Lerch” <wojtek_l@yahoo.ca> wrote in message
news:aqu23t$efi$1@nntp.qnx.com

Rodney Lott <> rlott@fct.ca> > wrote:
You might want to take a look at the Pt_ARG_FLAGS bit called
Pt_CALLBACKS_ACTIVE. Generically speaking, this makes callbacks active
if a
widget’s value has been manipulated in code. Specifically speaking, if
you
set this bit and then select an item from code, it will invoke the
callback.

No it won’t. The Pt_CALLBACKS_ACTIVE flag only affect certain
callbacks, and all those cases are documented. This is how it’s
explained in the docs:

Pt_CALLBACKS_ACTIVE

If certain widgets have this bit set, and your application sets
their resources, the relevant callbacks are invoked. Otherwise
callbacks aren’t invoked when your application sets resources. If a
callback refers to this flag, its description says so explicitly.

Notice that the documentation of Pt_CB_SELECTION does not mention
Pt_CALLBACKS_ACTIVE.


Wojtek Lerch QNX Software Systems Ltd.

Sorry! My bad. See Wojtek’s replies!

Regards.

Rodney

“Rodney Lott” <rlott@fct.ca> wrote in message
news:aqu1mo$kna$1@inn.qnx.com

And, you have called PtListSelectPos() to select the first element after
repopulating the list?

Rodney.

“Shashank” <> sbalijepalli@precitech.com> > wrote in message
news:aqtvrh$ilq$> 1@inn.qnx.com> …

Hello,
I set the Pt_CALLBACKS_ACTIVE bit. But it still doesn’t work. Any
clues??

Shashank

“Rodney Lott” <> rlott@fct.ca> > wrote in message
news:aqtkab$5do$> 1@inn.qnx.com> …
Hello.

You might want to take a look at the Pt_ARG_FLAGS bit called
Pt_CALLBACKS_ACTIVE. Generically speaking, this makes callbacks
active
if
a
widget’s value has been manipulated in code. Specifically speaking,
if
you
set this bit and then select an item from code, it will invoke the
callback.
So, when you add the new items after deleting all of the previous
ones,
you
could call PtListSelectPos() to select the first item and thus invoke
your
callback ( given that the Pt_CALLBACKS_ACTIVE bit is set ).

Regards.

Rodney Lott

“Shashank” <> sbalijepalli@precitech.com> > wrote in message
news:aqtj2l$45n$> 1@inn.qnx.com> …
Hi,
I am using a PtList widget in my program and adding some strings to
the
list
using the PtListAddItems() function. The selection
mode(Pt_ARG_SEL_MODE)
for
the list is the Browse mode and I have defined a Pt_CB_SELECTION
callback
where I keep track of the item_count and item_postion. The first
time
I
display the items it invokes this callback. But if I delete all the
items
and call the PtListAddItems() with a different set of strings it
fails
to
invoke the callback until I hit the Up/Down keys.
Your help is appreciated.

Thank you,
Shashank




\

You are right. But I would like the callback to be invoked every time I add
items to the list which it doen’t seem to do. I have a keyboard handler
where I delete the items and add new items.
Thanks for all the help.
Shashank

“Wojtek Lerch” <wojtek_l@yahoo.ca> wrote in message
news:aqu21s$eec$1@nntp.qnx.com

Shashank <> sbalijepalli@precitech.com> > wrote:
I set the Pt_CALLBACKS_ACTIVE bit. But it still doesn’t work. Any
clues??

This has nothing to do with the Pt_CALLBACKS_ACTIVE bit. The
Pt_CALLBACKS_ACTIVE bit does not affect the Pt_CB_SELECTION callback.
Only callbacks whose docs specifically mention Pt_CALLBACKS_ACTIVE are
affected by Pt_CALLBACKS_ACTIVE. (Unless, of course, we have forgotten
to document some cases…)

What’s happening in your program is that when the widget gets focus, it
automatically selects the current item (unless, of course, there are no
items in the widget – that’s why you’re not getting the callback when
the list is empty). This behaviour can be disabled by setting
Pt_SELECTION_MODE_NOFOCUS – check the docs for Pt_ARG_SELECTION_MODE
for details.




Shashank

“Rodney Lott” <> rlott@fct.ca> > wrote in message
news:aqtkab$5do$> 1@inn.qnx.com> …
Hello.

You might want to take a look at the Pt_ARG_FLAGS bit called
Pt_CALLBACKS_ACTIVE. Generically speaking, this makes callbacks active
if
a
widget’s value has been manipulated in code. Specifically speaking, if
you
set this bit and then select an item from code, it will invoke the
callback.
So, when you add the new items after deleting all of the previous ones,
you
could call PtListSelectPos() to select the first item and thus invoke
your
callback ( given that the Pt_CALLBACKS_ACTIVE bit is set ).

Regards.

Rodney Lott

“Shashank” <> sbalijepalli@precitech.com> > wrote in message
news:aqtj2l$45n$> 1@inn.qnx.com> …
Hi,
I am using a PtList widget in my program and adding some strings to
the
list
using the PtListAddItems() function. The selection
mode(Pt_ARG_SEL_MODE)
for
the list is the Browse mode and I have defined a Pt_CB_SELECTION
callback
where I keep track of the item_count and item_postion. The first time
I
display the items it invokes this callback. But if I delete all the
items
and call the PtListAddItems() with a different set of strings it
fails
to
invoke the callback until I hit the Up/Down keys.
Your help is appreciated.

Thank you,
Shashank





\

Wojtek Lerch QNX Software Systems Ltd.

Shashank <sbalijepalli@precitech.com> wrote:

You are right. But I would like the callback to be invoked every time I add
items to the list which it doen’t seem to do. I have a keyboard handler
where I delete the items and add new items.

Well, the Pt_CB_SELECTION callback has nothing to do with adding or
removing items. Its purpose is to tell you that a user action changed
the selection.

Since items can only be added or deleted from your own code, you don’t
need a callback to tell you when you’re adding or removing items. Just
call your “callback” directly whenever you’re adding or removing
items…

Thanks for all the help.
Shashank

“Wojtek Lerch” <> wojtek_l@yahoo.ca> > wrote in message
news:aqu21s$eec$> 1@nntp.qnx.com> …
Shashank <> sbalijepalli@precitech.com> > wrote:
I set the Pt_CALLBACKS_ACTIVE bit. But it still doesn’t work. Any
clues??

This has nothing to do with the Pt_CALLBACKS_ACTIVE bit. The
Pt_CALLBACKS_ACTIVE bit does not affect the Pt_CB_SELECTION callback.
Only callbacks whose docs specifically mention Pt_CALLBACKS_ACTIVE are
affected by Pt_CALLBACKS_ACTIVE. (Unless, of course, we have forgotten
to document some cases…)

What’s happening in your program is that when the widget gets focus, it
automatically selects the current item (unless, of course, there are no
items in the widget – that’s why you’re not getting the callback when
the list is empty). This behaviour can be disabled by setting
Pt_SELECTION_MODE_NOFOCUS – check the docs for Pt_ARG_SELECTION_MODE
for details.




Shashank

“Rodney Lott” <> rlott@fct.ca> > wrote in message
news:aqtkab$5do$> 1@inn.qnx.com> …
Hello.

You might want to take a look at the Pt_ARG_FLAGS bit called
Pt_CALLBACKS_ACTIVE. Generically speaking, this makes callbacks active
if
a
widget’s value has been manipulated in code. Specifically speaking, if
you
set this bit and then select an item from code, it will invoke the
callback.
So, when you add the new items after deleting all of the previous ones,
you
could call PtListSelectPos() to select the first item and thus invoke
your
callback ( given that the Pt_CALLBACKS_ACTIVE bit is set ).

Regards.

Rodney Lott

“Shashank” <> sbalijepalli@precitech.com> > wrote in message
news:aqtj2l$45n$> 1@inn.qnx.com> …
Hi,
I am using a PtList widget in my program and adding some strings to
the
list
using the PtListAddItems() function. The selection
mode(Pt_ARG_SEL_MODE)
for
the list is the Browse mode and I have defined a Pt_CB_SELECTION
callback
where I keep track of the item_count and item_postion. The first time
I
display the items it invokes this callback. But if I delete all the
items
and call the PtListAddItems() with a different set of strings it
fails
to
invoke the callback until I hit the Up/Down keys.
Your help is appreciated.

Thank you,
Shashank





\

Wojtek Lerch QNX Software Systems Ltd.


Wojtek Lerch QNX Software Systems Ltd.

Hello,
I can do that. But what I don’t understand is the first time I add items to
the list the callback is invoked. You said this is because the list gets
focus. Is there a way to give focus to the list when I delete or add items
from the keyboard handler.

Thanks for the help,
Shashank

“Wojtek Lerch” <wojtek_l@yahoo.ca> wrote in message
news:aquift$oop$1@nntp.qnx.com

Shashank <> sbalijepalli@precitech.com> > wrote:
You are right. But I would like the callback to be invoked every time I
add
items to the list which it doen’t seem to do. I have a keyboard handler
where I delete the items and add new items.

Well, the Pt_CB_SELECTION callback has nothing to do with adding or
removing items. Its purpose is to tell you that a user action changed
the selection.

Since items can only be added or deleted from your own code, you don’t
need a callback to tell you when you’re adding or removing items. Just
call your “callback” directly whenever you’re adding or removing
items…

Thanks for all the help.
Shashank

“Wojtek Lerch” <> wojtek_l@yahoo.ca> > wrote in message
news:aqu21s$eec$> 1@nntp.qnx.com> …
Shashank <> sbalijepalli@precitech.com> > wrote:
I set the Pt_CALLBACKS_ACTIVE bit. But it still doesn’t work. Any
clues??

This has nothing to do with the Pt_CALLBACKS_ACTIVE bit. The
Pt_CALLBACKS_ACTIVE bit does not affect the Pt_CB_SELECTION callback.
Only callbacks whose docs specifically mention Pt_CALLBACKS_ACTIVE are
affected by Pt_CALLBACKS_ACTIVE. (Unless, of course, we have forgotten
to document some cases…)

What’s happening in your program is that when the widget gets focus, it
automatically selects the current item (unless, of course, there are no
items in the widget – that’s why you’re not getting the callback when
the list is empty). This behaviour can be disabled by setting
Pt_SELECTION_MODE_NOFOCUS – check the docs for Pt_ARG_SELECTION_MODE
for details.




Shashank

“Rodney Lott” <> rlott@fct.ca> > wrote in message
news:aqtkab$5do$> 1@inn.qnx.com> …
Hello.

You might want to take a look at the Pt_ARG_FLAGS bit called
Pt_CALLBACKS_ACTIVE. Generically speaking, this makes callbacks
active
if
a
widget’s value has been manipulated in code. Specifically speaking,
if
you
set this bit and then select an item from code, it will invoke the
callback.
So, when you add the new items after deleting all of the previous
ones,
you
could call PtListSelectPos() to select the first item and thus
invoke
your
callback ( given that the Pt_CALLBACKS_ACTIVE bit is set ).

Regards.

Rodney Lott

“Shashank” <> sbalijepalli@precitech.com> > wrote in message
news:aqtj2l$45n$> 1@inn.qnx.com> …
Hi,
I am using a PtList widget in my program and adding some strings
to
the
list
using the PtListAddItems() function. The selection
mode(Pt_ARG_SEL_MODE)
for
the list is the Browse mode and I have defined a Pt_CB_SELECTION
callback
where I keep track of the item_count and item_postion. The first
time
I
display the items it invokes this callback. But if I delete all
the
items
and call the PtListAddItems() with a different set of strings it
fails
to
invoke the callback until I hit the Up/Down keys.
Your help is appreciated.

Thank you,
Shashank





\

Wojtek Lerch QNX Software Systems
Ltd.


\

Wojtek Lerch QNX Software Systems Ltd.

Shashank <sbalijepalli@precitech.com> wrote:

I can do that. But what I don’t understand is the first time I add items to
the list the callback is invoked. You said this is because the list gets
focus. Is there a way to give focus to the list when I delete or add items
from the keyboard handler.

Sure, you can call PtContainerGiveFocus(), but it will do nothing if
your list already has focus, and the list will do nothing if an item is
already selected.

The callback you’re getting is not directly caused by the fact that you
just added some items – the direct cause of the callback is that when
the widget got focus, there was no selection, so the widget decided to
pick an item and select it. The general idea behind the BROWSE mode is
that you want the user to choose exactly one item, and therefore it
doesn’t make sense to let him see a list with no selection in it.


Wojtek Lerch QNX Software Systems Ltd.