PHAB and Widget databases.

Hi All,

I’m having problems realizing widgets stored in a PHAB database. I have a
PHAB project, and in it I have an internal link to a picture module called
Widgies. In Widgies is a PtText widget called MyText. I have a window module
containing a PtButton widget who’s armed callback is as shown below. When I
hit the button, I am expecting to see an instance of MyText appear, but I
get nothing. As far as I can tell, the database is open (ApOpenDBase returns
a consistent and non-NULL value) and I am instantiating the widget
(ApCreateWidget returns a non-NULL value), but I don’t see the instance
displayed. Any ideas?
Thanks in advance.

Nick Tipping.

#define X_HN_START 100
#define Y_HN_START 120

ApDBase_t *MyWidgies
PtArg_t args[2];

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

{

int i, x_pos, y_pos;


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

x_pos = X_HN_START;
y_pos = Y_HN_START;

MyWidgies = ApOpenDBase(ABM_Widgies);
PtSetArg(&args[0], Pt_ARG_TEXT_STRING, “Test”, 0);
PtSetArg(&args[1], Pt_ARG_FILL_COLOR, Pg_WHITE, 0);
ApCreateWidget(MyWidgies, “MyText”, x_pos, y_pos, 2, args);
ApCloseDBase(MyWidgies);

return( Pt_CONTINUE );

}

Nick Tipping wrote:

Hi All,

I’m having problems realizing widgets stored in a PHAB database. I have a
PHAB project, and in it I have an internal link to a picture module called
Widgies. In Widgies is a PtText widget called MyText. I have a window module
containing a PtButton widget who’s armed callback is as shown below. When I
hit the button, I am expecting to see an instance of MyText appear, but I
get nothing. As far as I can tell, the database is open (ApOpenDBase returns
a consistent and non-NULL value) and I am instantiating the widget
(ApCreateWidget returns a non-NULL value), but I don’t see the instance
displayed. Any ideas?
Thanks in advance.

Nick Tipping.

#define X_HN_START 100
#define Y_HN_START 120

ApDBase_t *MyWidgies
PtArg_t args[2];

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

{

int i, x_pos, y_pos;

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

x_pos = X_HN_START;
y_pos = Y_HN_START;

MyWidgies = ApOpenDBase(ABM_Widgies);
PtSetArg(&args[0], Pt_ARG_TEXT_STRING, “Test”, 0);
PtSetArg(&args[1], Pt_ARG_FILL_COLOR, Pg_WHITE, 0);
ApCreateWidget(MyWidgies, “MyText”, x_pos, y_pos, 2, args);
ApCloseDBase(MyWidgies);

return( Pt_CONTINUE );

}

You can try that sequence:

PtSetArg(…);
PtSetArg(…);
PtSetParentWidget();
ApCreateWidget(…);
ApCloseDBase(…);
PtReRealizeWidget();

Eugene A. Kislov <evkislov@asutp.yorp.yaroslavl.ru> wrote:

You can try that sequence:

PtSetParentWidget();

This seems like the most likely problem.

ApCloseDBase(…);

Be careful when you do this. I used to give widgets in
a database a graphic image, and then I found that when
the realized the graphic data was crap. I finally found
out that the problem was that I was closing the database.

Mitchell Schoenbrun --------- maschoen@pobox.com

Mitchell Schoenbrun <maschoen@tsoft.com> wrote:
: Be careful when you do this. I used to give widgets in
: a database a graphic image, and then I found that when
: the realized the graphic data was crap. I finally found
: out that the problem was that I was closing the database.

There is a note about that in the docs, but not in the description of
ApCloseDBase(). I’ll propagate it.


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