PtRaw use

I use a library which can provide to client some image. It’s a generic library i used before on Windows/WinCE on MFC:
. Client had to provide offscreen informations;
. Then, the library filled the offscreen buffer;
. Then, client had only to display it.

I find in Photon Help corresponding features, based upon PgGetVideoMode, PgGetVideoModeInfo, but it implies to use PdSetTargetDevice before:
. I use PhDCGetCurrent() as drawContext as first parameter;
. I use PtWidgetRid(widget) as region ID (2nd parameter).

I do all above treatment in Draw callback of a PtRaw object and PgGetVideoMode failed always.

So, I can’t set offscreen parameters as well.

Heeeeeeeeeeeellllllllllllllp !

To sum up my problem, here’s the corresponding code below:
. On a Widget PtRaw;
. Draw function :

void Draw(PtWidget_t * widget, PhTile_t *damage) {
PgDisplaySettings_t *lpDisplaySettings=NULL;
PhDrawContext_t *lpPhDrawContext=PhDCGetCurrent(); //not NULL OK
PdSetTargetDevice(lpPhDrawContext, PtWidgetRid(widget));
PgGetVideoMode(lpDisplaySettings); //return error : why !

This may be of help … … le=apr1001

Thanks, i tried it:
. I can reproduce the example on a widget create just like precised, with the 3 proposed solutions;
. If I replace the widget created such as below …

 // initialize our connection to Photon, and create/realize a window 

… by the one I want to fill with test buffer, it doesn’t work !
Nothing is displayed in the widget area. The widget used is a scare PtRaw widget, with same dimensions as the example’s one (256x256).
There’s no crash for the 3 solutions, but nothing is displayed …

Could you help me, please ?

How are you driving the main event processing loop?

Excuse me but I’m just a beginner on Photon : perhaps, I’m asking some obvious questions …
I’ve not taken into account any main event processing loop problem …
I have created a “Plain” project with several widget included. The only handly code added, is implemented in the Draw callback of the PtRaw widget : As I obtain the waited debug printf, this callback is called each time a redraw is needed.
Thanks you for your help !

Good news :smiley:

I finally found the solution to my problem, when reading
I had to set Pt_REGION flag in the widget’s Pt_ARG_FLAGS resource and it works …
Sorry if it’s an obvious error … I’m a beginner on Photon …
Thx for your help !