Hi,
the problem was that you didn’t call PtDamageWidget() on the raw widget you created in PhAB; instead, a local static widget pointer ‘raw’ was used
in data_update.c . You’ll need to call the damage function on ‘ABW_raw’ as shown below, then everything works just fine.
Remember: When you create a widget in PhAB and give it a name, e.g., ‘blah’, then that widget will be addressable as ‘ABW_blah’ in your
code.
Kind regards,
Thomas
/* Y o u r D e s c r i p t i o n */
/* AppBuilder Photon Code Lib */
/* Version 2.03 */
/* Standard headers */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
/* Local headers */
#include "ablibs.h"
#include "abimport.h"
#include "proto.h"
int a;
char sbuf[256];
<<< static PtWidget_t *raw;
PhRect_t rect;
int
data_update( PtWidget_t *raw, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo )
{
char sbuf[256];
/* eliminate 'unreferenced' warnings */
raw = raw, apinfo = apinfo, cbinfo = cbinfo;
a++;
<<< PtDamageWidget(raw);
>>> PtDamageWidget(ABW_raw);
<<< PtFlush();
<<< usleep(10000);
return( Pt_CONTINUE );
}
From: 413488699 [mailto:community-noreply@qnx.com]
Sent: Dienstag, 29. Juli 2014 09:25
To: photon-graphics
Subject: Re:RE: A question about PtDamageWidget
Thx for reply, I write a simple case, the drawfunction didn't invoke actually.
In this case, I want to draw a new line each time, the code is here.
------------------ Original ------------------
From:
"Thomas Haupt";<community-noreply@qnx.com>;
Date:
Tue, Jul 29, 2014 03:16 PM
To:
"'photon-graphics@community.qnx.com'"<photon-graphics@community.qnx.com>;
Subject:
RE: A question about PtDamageWidget
Hi,
sounds a bit odd - ordinarily, I'd expect PtDamageWidget() to cause the draw function being invoked. Are you sure it isn't called, or could it be you just got something in the drawing code wrong (e.g., bad translation, missing flush...)? Did you check with
a debugger/log message when the draw function gets called? Can you perhaps post a small test case?
Cheers,
Thomas
-----Original Message-----
From: Xiang Lu [mailto:community-noreply@qnx.com]
Sent: Dienstag, 29. Juli 2014 09:07
To: photon-graphics
Subject: A question about PtDamageWidget
Hi, i'm new to Photon developing and I have a problem with my app.
I'm trying to use a PtRaw widget to display some graphic made with Photon functions such as PgDrawPolygon, etc. I want to make the raw widget damaged (redrawn) every 1000ms with a timer.
In the timer's callback,I call PtDamageWidget(raw) to damage the PtRaw Widget and invoke the drawfunction.But after running it,I found PtDamageWidget() didn't invoke the drawfuntion.Does anyone know the reason,thanks in advance.
_______________________________________________
Photon microGUI
http://community.qnx.com/sf/go/post111246
To cancel your subscription to this discussion, please e-mail
photon-graphics-unsubscribe@community.qnx.com
_______________________________________________
Photon microGUI
http://community.qnx.com/sf/go/post111247
To cancel your subscription to this discussion, please e-mail
photon-graphics-unsubscribe@community.qnx.com