Skip navigation.
Home
The QNX Community Portal

View topic - Draw method in photon framework

Draw method in photon framework

Isn't the name clear?

Draw method in photon framework

Postby ban » Thu Sep 18, 2008 4:38 am

Hi All,
What is the GUI Drawing Mechanism in photon framework. As i want to call my drawing function within the framework draw method.
ban
New Member
 
Posts: 6
Joined: Thu Aug 28, 2008 10:09 am

RE: Draw method in photon framework

Postby micro » Thu Sep 18, 2008 3:13 pm

There are different Drawing options

Pg*

will be the most relevant in your case i think. Be sure to draw in a PtRaw or similar
micro
Senior Member
 
Posts: 458
Joined: Thu Jul 22, 2004 8:41 pm

RE: Draw method in photon framework

Postby ban » Fri Sep 19, 2008 4:28 am

Thanks micro,
still it is not clear. Let me give you a scenario. Suppose i have a DrawLine() function. On the click of a buttton i want to call this function, it will draw a line on the Gui. But as soon as i go for minimise and maximise it, it disappers.
Now i want this function to be called from within the GUI drawing method. I believe their must be some callback function for drawing that is invoked as a paint event fires.
ban
New Member
 
Posts: 6
Joined: Thu Aug 28, 2008 10:09 am

Re: RE: Draw method in photon framework

Postby maschoen » Fri Sep 19, 2008 3:47 pm

ban wrote:Thanks micro,
still it is not clear. Let me give you a scenario. Suppose i have a DrawLine() function. On the click of a buttton i want to call this function, it will draw a line on the Gui. But as soon as i go for minimise and maximise it, it disappers.
Now i want this function to be called from within the GUI drawing method. I believe their must be some callback function for drawing that is invoked as a paint event fires.


Ok, I can see that some things are not clear. When your button is clicked, you call a PgDraw function. This does not draw exactly. It puts a draw command into a buffer. When you exit the button callback, this draw command (and any other's that have been buffered) will be turned into draw events which will then be caught by the video driver, updating the screen. The problem with drawing is that Photon does not keep track of what has been drawn, so if you min and then max a wiindow, what was previously drawn is gone. You must restore the drawing yourself. The Raw widgets helps by giving you a callback in which you should do your drawing. What happens at the Photon kernel is that when you max your window (or an overlapping windows is removed) a "reveal" event occurs, causing the callback to be called.

This is often seems awkward at first, especially if you have a dynamic drawing. If you call draw events in a loop with a delay of some kind, you will never see them. One way around this is to have a timer wake up your program periodically to do the updates.
maschoen
QNX Master
 
Posts: 2644
Joined: Wed Jun 25, 2003 5:18 pm


Return to GUI Programming

Who is online

Users browsing this forum: No registered users and 1 guest