PtGenListDrawString overiding context text color?

We are porting our applications from QNX 4 to QNX 6.3.0. Under QNX 4, we
created a custom list widget which allowed displaying each element using a
different color (i.e. a PtColorList). To change the colors, we did the
following:

PgSetTextColor(color_items->fore_color);
PgSetFillColor(color_items->back_color);
PtGenListDrawString(widget, items, (color_items->text), &rect, 0, 0);

This is no longer working properly. The items are being drawn using the
default foreground color for the widget. The background color (fill) seems
to be working properly. Is there a way around this?

I’ve confirmed that this is the case, and found a work around, but I’m not
crazy about it, as it involves dynamically changing the “color” attribute of
the widget before issuing the PtGenListDrawString call. I suppose it
works…

“Richard Doucet” <doucetr@aecl.ca> wrote in message
news:cq4dro$gpa$1@inn.qnx.com

We are porting our applications from QNX 4 to QNX 6.3.0. Under QNX 4, we
created a custom list widget which allowed displaying each element using a
different color (i.e. a PtColorList). To change the colors, we did the
following:

PgSetTextColor(color_items->fore_color);
PgSetFillColor(color_items->back_color);
PtGenListDrawString(widget, items, (color_items->text), &rect, 0, 0);

This is no longer working properly. The items are being drawn using the
default foreground color for the widget. The background color (fill)
seems
to be working properly. Is there a way around this?

In 6.3, PtGenListDrawString() doesn’t rely on the colours and font set
by the caller, but instead uses a new PtGenListItemAttrs_t structure.
There’s a new “item attributes” method that PtGenListDrawString() calls
to ask you what attributes to use to draw an item.

The method takes the pointers to a widget and an item, and returns a
pointer to an attributes structure:

typedef const PtGenListItemAttrs_t *PtGenListGetItemAttrsF_t(
PtWidget_t *widget, PtGenListItem_t const *item
);

Use the Pt_SET_LIST_ITEMATTRS_F macro to define your method:

static const PtClassArg_t args[] = {

{ Pt_SET_LIST_ITEMATTRS_F, itemattrs },

};

If you return NULL, the widget’s resources will be used. Also, if any
of the colours in the attributes structure are set to P_TRANSPARENT, or
the font is NULL, the corresponding widget-wide setting will be used.

Sorry this isn’t in the docs yet – I’ll try to make sure it gets there
as soon as possible…

Richard Doucet wrote:

I’ve confirmed that this is the case, and found a work around, but I’m not
crazy about it, as it involves dynamically changing the “color” attribute of
the widget before issuing the PtGenListDrawString call. I suppose it
works…

“Richard Doucet” <> doucetr@aecl.ca> > wrote in message
news:cq4dro$gpa$> 1@inn.qnx.com> …

We are porting our applications from QNX 4 to QNX 6.3.0. Under QNX 4, we
created a custom list widget which allowed displaying each element using a
different color (i.e. a PtColorList). To change the colors, we did the
following:

PgSetTextColor(color_items->fore_color);
PgSetFillColor(color_items->back_color);
PtGenListDrawString(widget, items, (color_items->text), &rect, 0, 0);

This is no longer working properly. The items are being drawn using the
default foreground color for the widget. The background color (fill)

seems

to be working properly. Is there a way around this?

\

I’ve also the same problem, I have to migrate a QNX6.2.1 application to
QNX6.3 and RawList management is not COMPATIBLE !!!

Documentation of new PtGenListDrawString() function is WRONG and for
instance I lose my time and money to find an adaptation…
Available messages present in forum doesn’t help me because there is no
example. There is no resource to make new PtGenListDrawString function use
color defined by application and no way to do it !

Why Qnx version is 6.3 instead of 7 !!!
In my company if new software version is not compatible major indice has to
change. Why QNX doesn’t do the same ?


When a new version or patch will be avalaible to correct RawList draw
management ?


Regards
G.Grange
email : ggrange@centralp.fr
web : www.centralp.fr


Richard Doucet a écrit dans le message …

We are porting our applications from QNX 4 to QNX 6.3.0. Under QNX 4, we
created a custom list widget which allowed displaying each element using a
different color (i.e. a PtColorList). To change the colors, we did the
following:

PgSetTextColor(color_items->fore_color);
PgSetFillColor(color_items->back_color);
PtGenListDrawString(widget, items, (color_items->text), &rect, 0, 0);

This is no longer working properly. The items are being drawn using the
default foreground color for the widget. The background color (fill) seems
to be working properly. Is there a way around this?

What is the final solution for this problem ?

I can solve a part of it using these functions :
PtSetResource(widget, Pt_ARG_COLOR, textColor, 0);
PtSetResource(widget, Pt_ARG_SELECTION_TEXT_COLOR, textColor, 0);
before i call PtGenListDrawString() new function but if there is selected
item it still works but when selected item(s) is unselected new display will
refresh display be make disapear old selected item(s) !!!
It’s not possible to use Pt_SET_LIST_ITEMATTRS_F, lack of documentation is
to big.


Can you give a sample or explain more how to use PtGenListDrawString() in
QNX6.3.0 version ?

Thanks
Gabriel GRANGE
email : ggrange@centralp.fr
web : www.centralp.fr




Wojtek Lerch a écrit dans le message <41DAD051.7000808@yahoo.ca>…

In 6.3, PtGenListDrawString() doesn’t rely on the colours and font set
by the caller, but instead uses a new PtGenListItemAttrs_t structure.
There’s a new “item attributes” method that PtGenListDrawString() calls
to ask you what attributes to use to draw an item.

The method takes the pointers to a widget and an item, and returns a
pointer to an attributes structure:

typedef const PtGenListItemAttrs_t *PtGenListGetItemAttrsF_t(
PtWidget_t *widget, PtGenListItem_t const *item
);

Use the Pt_SET_LIST_ITEMATTRS_F macro to define your method:

static const PtClassArg_t args[] = {

{ Pt_SET_LIST_ITEMATTRS_F, itemattrs },

};

If you return NULL, the widget’s resources will be used. Also, if any
of the colours in the attributes structure are set to P_TRANSPARENT, or
the font is NULL, the corresponding widget-wide setting will be used.

Sorry this isn’t in the docs yet – I’ll try to make sure it gets there
as soon as possible…

Richard Doucet wrote:
I’ve confirmed that this is the case, and found a work around, but I’m
not
crazy about it, as it involves dynamically changing the “color” attribute
of
the widget before issuing the PtGenListDrawString call. I suppose it
works…

“Richard Doucet” <> doucetr@aecl.ca> > wrote in message
news:cq4dro$gpa$> 1@inn.qnx.com> …

We are porting our applications from QNX 4 to QNX 6.3.0. Under QNX 4,
we
created a custom list widget which allowed displaying each element using
a
different color (i.e. a PtColorList). To change the colors, we did the
following:

PgSetTextColor(color_items->fore_color);
PgSetFillColor(color_items->back_color);
PtGenListDrawString(widget, items, (color_items->text), &rect, 0, 0);

This is no longer working properly. The items are being drawn using the
default foreground color for the widget. The background color (fill)

seems

to be working properly. Is there a way around this?

\

PAYRE serge wrote:

What is the final solution for this problem ?

I can solve a part of it using these functions :
PtSetResource(widget, Pt_ARG_COLOR, textColor, 0);
PtSetResource(widget, Pt_ARG_SELECTION_TEXT_COLOR, textColor, 0);
before i call PtGenListDrawString()

That’s not a good solution. It’s wrong to set resources in a widget’s
draw function.

It’s not possible to use Pt_SET_LIST_ITEMATTRS_F, lack of documentation is
to big.

It’s not very complicated, and most of the details shouldn’t be too
difficult to guess from the header file… Your item-attributes
function needs to be defined with a prototype that matches the typedef
“PtGenListGetItemAttrsF_t”:

typedef const PtGenListItemAttrs_t *PtGenListGetItemAttrsF_t(
PtWidget_t *widget, PtGenListItem_t const *item
);

The function should return NULL or the address of a PtGenListItemAttrs_t
structure that describes what font and colours should be used to draw
the item that was passed in. Since this function will be called every
time an item is drawn, you should avoid doing any time-consuming work in
it. The structure is looked at only immediately after your function
returns its address – it’s OK to use the same static structure for all
items.

The PtGenListItemAttrs_t structure contains a font and two pairs of
colours – a foreground and a background colour for unselected and
selected items:

typedef struct Pt_gen_list_color_set {
PgColor_t text, fill;
}
PtGenListColorSet_t;

typedef struct Pt_genlist_item_attrs {
const char *font;
PtGenListColorSet_t unselected_colors;
PtGenListColorSet_t selected_colors;
unsigned flags;
}
PtGenListItemAttrs_t;

If the font is not NULL, or a colour is different than Pg_TRANSPARENT,
it’s used as an override for the corresponding widget resource. If you
don’t want to override any of the widget’s resources for a particular
item, your item-attributes function can return NULL.

PtGenListItemAttrs_t also contains a member called “flags”, but no flags
are defined at the moment and you should set it to zero.

If you’re writing your own widget derived from PtGenList, you should use
Pt_SET_LIST_ITEMATTRS_F to set your item-attributes function the same
way you’re using Pt_SET_LIST_DRAW_F to set the draw function. If you’re
creating a PtRawList widget, you should use Pt_ARG_RAWLIST_ITEMATTR_F to
set your function the same way you’re using Pt_ARG_RAWLIST_DRAW_F to set
the draw function.

Do you think the above is still missing some details?


Can you give a sample or explain more how to use PtGenListDrawString() in
QNX6.3.0 version ?

Thanks
Gabriel GRANGE
email : > ggrange@centralp.fr
web : > www.centralp.fr




Wojtek Lerch a écrit dans le message <> 41DAD051.7000808@yahoo.ca> >…

In 6.3, PtGenListDrawString() doesn’t rely on the colours and font set
by the caller, but instead uses a new PtGenListItemAttrs_t structure.
There’s a new “item attributes” method that PtGenListDrawString() calls
to ask you what attributes to use to draw an item.

The method takes the pointers to a widget and an item, and returns a
pointer to an attributes structure:

typedef const PtGenListItemAttrs_t *PtGenListGetItemAttrsF_t(
PtWidget_t *widget, PtGenListItem_t const *item
);

Use the Pt_SET_LIST_ITEMATTRS_F macro to define your method:

static const PtClassArg_t args[] = {

{ Pt_SET_LIST_ITEMATTRS_F, itemattrs },

};

If you return NULL, the widget’s resources will be used. Also, if any
of the colours in the attributes structure are set to P_TRANSPARENT, or
the font is NULL, the corresponding widget-wide setting will be used.

Sorry this isn’t in the docs yet – I’ll try to make sure it gets there
as soon as possible…

Richard Doucet wrote:

I’ve confirmed that this is the case, and found a work around, but I’m

not

crazy about it, as it involves dynamically changing the “color” attribute

of

the widget before issuing the PtGenListDrawString call. I suppose it
works…

“Richard Doucet” <> doucetr@aecl.ca> > wrote in message
news:cq4dro$gpa$> 1@inn.qnx.com> …


We are porting our applications from QNX 4 to QNX 6.3.0. Under QNX 4,

we

created a custom list widget which allowed displaying each element using

a

different color (i.e. a PtColorList). To change the colors, we did the
following:

PgSetTextColor(color_items->fore_color);
PgSetFillColor(color_items->back_color);
PtGenListDrawString(widget, items, (color_items->text), &rect, 0, 0);

This is no longer working properly. The items are being drawn using the
default foreground color for the widget. The background color (fill)

seems


to be working properly. Is there a way around this?



\