create line using PtCreateWidget

hi,

i am not able to create line using PtCreateWidget.

while creating line i set area arguments to area.pos.x = 100 y = 325
and area.size.w = 100 h = 1. PtCreatWidget is returning a pointer for
newly created widget. i used this pointer to set color to RED and line
width to 2. then i passed the New Widget to PtRealizeWidget () function. i
also rerealized the window in which i want to create the line.

but i am not able to see the line in the window. i have confirmed that
the position arguments of the line are within the visible part of the
window.

can we create line with PtCreateWidget() or we have to use DrawLine ()
only.

pl. help

thanks in advance

sameer

hi all,

please reply, if you have any comments, ideas, example about creating
line using PtCreateWidget () function

thanking you

sameer

Hello Sam,

First of all, I’d like to know:

Have you tried using PhAB to create your widgets?
Using the application builder usually makes it unnecessary to use the
PtCreateWidget function, as well as gives you direct control on which window
is the owner of each widget. Once you dragged your PtLine on the window, it
would then be a simple matter of setting the widget’s attributes in your
code.

Regards

Stéphane S.




“sam” <seto@vsnl.com> a écrit dans le message de news:
be1ccd$jgo$1@tiger.openqnx.com

hi,

i am not able to create line using PtCreateWidget.

while creating line i set area arguments to area.pos.x = 100 y = 325
and area.size.w = 100 h = 1. PtCreatWidget is returning a pointer for
newly created widget. i used this pointer to set color to RED and line
width to 2. then i passed the New Widget to PtRealizeWidget () function. i
also rerealized the window in which i want to create the line.

but i am not able to see the line in the window. i have confirmed that
the position arguments of the line are within the visible part of the
window.

can we create line with PtCreateWidget() or we have to use DrawLine ()
only.

pl. help

thanks in advance

sameer

sam <seto@vsnl.com> wrote:
: hi,

: i am not able to create line using PtCreateWidget.

: while creating line i set area arguments to area.pos.x = 100 y = 325
: and area.size.w = 100 h = 1. PtCreatWidget is returning a pointer for
: newly created widget. i used this pointer to set color to RED and line
: width to 2. then i passed the New Widget to PtRealizeWidget () function. i
: also rerealized the window in which i want to create the line.

: but i am not able to see the line in the window. i have confirmed that
: the position arguments of the line are within the visible part of the
: window.

Pt_ARG_AREA specifies the location and size of the widget, but you also
have to set the widget’s Pt_ARG_POINTS resource to be the start and end
points for the line. If this isn’t the problem, could you please post
you code?


Steve Reid stever@qnx.com
TechPubs (Technical Publications)
QNX Software Systems

works for me:

PtWidget_t *w;
PtArg_t args[2];
PhPoint_t origin = { 50, 50 };
PhPoint_t points[] = { { 10, 10 },
{ 100, 200 } };

PtSetArg( &args[0], Pt_ARG_ORIGIN, &origin, 0 );
PtSetArg( &args[1], Pt_ARG_POINTS, points, 2 );
w = PtCreateWidget( PtLine, NULL, 3, args );
PtRealizeWidget( w );

“sam” <seto@vsnl.com> wrote in message news:be6n52$9la$1@inn.qnx.com

hi all,

please reply, if you have any comments, ideas, example about creating
line using PtCreateWidget () function

thanking you

sameer

Thank YOU ALL,

for your support.

now the code is working, i found the problem.

problem : i was setting the Pt_ARG_COLOR to RED but i did not set anything
to Pt_ARG_FILL_COLOR - by default that was transparent. i set LINE_WIDTH to
3 but LINE_BORDER was getting set to 3. so now i am setting ARG_COLOR and
FILL_COLOR to RED and LINE_WIDTH to 3 and BORDER_WIDTH to 0 explicitly.

only one thing i noticed with line created with code and line created from
PhAB. with line created with PhAB, the widget->data is set to 3 and
widget->destroyed is set to some structure, i think this structure contains
one callback ApFree~ . but line created with code these are set to NULL.

is this widget->data and widget->destroyed information is required for line
created with code?

thanks again,

sameer


“Martin Michalek” <michalek@procaut.sk> wrote in message
news:bedrf4$6ko$1@inn.qnx.com

works for me:

PtWidget_t *w;
PtArg_t args[2];
PhPoint_t origin = { 50, 50 };
PhPoint_t points[] = { { 10, 10 },
{ 100, 200 } };

PtSetArg( &args[0], Pt_ARG_ORIGIN, &origin, 0 );
PtSetArg( &args[1], Pt_ARG_POINTS, points, 2 );
w = PtCreateWidget( PtLine, NULL, 3, args );
PtRealizeWidget( w );

“sam” <> seto@vsnl.com> > wrote in message news:be6n52$9la$> 1@inn.qnx.com> …
hi all,

please reply, if you have any comments, ideas, example about creating
line using PtCreateWidget () function

thanking you

sameer
\

sam <seto@vsnl.com> wrote:

only one thing i noticed with line created with code and line created from
PhAB. with line created with PhAB, the widget->data is set to 3 and
widget->destroyed is set to some structure, i think this structure contains
one callback ApFree~ . but line created with code these are set to NULL.

is this widget->data and widget->destroyed information is required for line
created with code?

No, those are used by the PhAB library to support things like
ApGetWidgetPtr(), ApName(), and ApInstanceName() (if enabled).

hi Wojtek Lerch,

thanks for information.

sameer