Photon 1.14

I got a very simple program consisting of a base windows, and a menu with 3
“button” in it.

There is a PtTimer with a callback that just does a DrawPtImagemx (name from
memory I don’t have source infront of me). The image to draw takes up the
whole windows minus the space of the menu. When the program start the
windows is empty even throught the Draw function is called with the proper
image. Then if one of the button is pressed in the menu the images is now
refresh (around every 50ms) properly. The callback to the menu button is
empty, it’s doing nothing. As a matter of fact it was put there because it
was the only way the guy that originaly wrote the program get something to
display, I’m baffled as well.

If I play around with other windows, moving them infront off the program i’m
talking about, the refresh will suddenly stop (I can confirm Drawblabal is
still being called). Pressing the menu button (any of them) get it going
again. I’m using this via Phindows but I’m told it’s doing the same running
local. The tag is genereated for each image (and the images is constantly
changing).

More info, there is no widget in the windows aside the menu. When windows
are move partialy in front of the culpit the most of the time the image gets
drawn properly.

Any hints?

  • Mario

The problem is that you’re trying to draw in a callback without setting
up all the details of the graphics context, such as the translation,
clipping, region to draw from, etc. Setting them all correctly is
somewhat tricky in general – it’s better to allow the Photon library to
do it for you. In other words, you need to put your drawing code in a
PtRaw widget’s draw function, and ask the library to call it by damaging
the raw widget. (If all you need to draw is one image, it’s even easier
– you can use a PtLabel instead of a PtRaw.)

Mario Charest wrote:

I got a very simple program consisting of a base windows, and a menu with 3
“button” in it.

There is a PtTimer with a callback that just does a DrawPtImagemx (name from
memory I don’t have source infront of me). The image to draw takes up the
whole windows minus the space of the menu. When the program start the
windows is empty even throught the Draw function is called with the proper
image. Then if one of the button is pressed in the menu the images is now
refresh (around every 50ms) properly. The callback to the menu button is
empty, it’s doing nothing. As a matter of fact it was put there because it
was the only way the guy that originaly wrote the program get something to
display, I’m baffled as well.

If I play around with other windows, moving them infront off the program i’m
talking about, the refresh will suddenly stop (I can confirm Drawblabal is
still being called). Pressing the menu button (any of them) get it going
again. I’m using this via Phindows but I’m told it’s doing the same running
local. The tag is genereated for each image (and the images is constantly
changing).

More info, there is no widget in the windows aside the menu. When windows
are move partialy in front of the culpit the most of the time the image gets
drawn properly.

Any hints?

  • Mario

“Wojtek Lerch” <Wojtek_L@yahoo.ca> wrote in message
news:c68k7h$2c8$2@inn.qnx.com

The problem is that you’re trying to draw in a callback without setting
up all the details of the graphics context, such as the translation,
clipping, region to draw from, etc. Setting them all correctly is
somewhat tricky in general – it’s better to allow the Photon library to
do it for you. In other words, you need to put your drawing code in a
PtRaw widget’s draw function, and ask the library to call it by damaging
the raw widget. (If all you need to draw is one image, it’s even easier
– you can use a PtLabel instead of a PtRaw.)

Exactly what I did (use PtLabel)

Mario Charest wrote:
I got a very simple program consisting of a base windows, and a menu
with 3
“button” in it.

There is a PtTimer with a callback that just does a DrawPtImagemx (name
from
memory I don’t have source infront of me). The image to draw takes up
the
whole windows minus the space of the menu. When the program start the
windows is empty even throught the Draw function is called with the
proper
image. Then if one of the button is pressed in the menu the images is
now
refresh (around every 50ms) properly. The callback to the menu button is
empty, it’s doing nothing. As a matter of fact it was put there because
it
was the only way the guy that originaly wrote the program get something
to
display, I’m baffled as well.

If I play around with other windows, moving them infront off the program
i’m
talking about, the refresh will suddenly stop (I can confirm Drawblabal
is
still being called). Pressing the menu button (any of them) get it
going
again. I’m using this via Phindows but I’m told it’s doing the same
running
local. The tag is genereated for each image (and the images is
constantly
changing).

More info, there is no widget in the windows aside the menu. When
windows
are move partialy in front of the culpit the most of the time the image
gets
drawn properly.

Any hints?

  • Mario