Project Home
Project Home
Trackers
Trackers
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Drawing Custom Widgets: (3 Items)
   
Drawing Custom Widgets  
I am creating custom widgets and found that when testing these widgets, I noticed that the draw order has an effect on 
some widgets.  

The widgets are updated every 1/2 second via a callback from a PtTimer.

So this is the problem.  I created 5 custom widgets.  I can add all 5 custom widgets to a window module and build and 
run the application.  Depending on the draw order of these widgets, only certain widgets will appear.  Those that do not
 appear will appear after I force a redraw (damage the widget).

So lets say widget number 5 is causing this problem.  If the draw order is 1 - 2 - 3 - 4 - 5, all widgets will appear.  
If the draw order is 4 - 2 - 5 - 3 - 1, widgets 3 and 1 will not be drawn until I force a redraw.  Widgets 4, 2 and 5 
will appear.

Right now I have 2-ish work arounds:
1. Always place widget 5 in a PtDBContainer (only 1 per PtDBContainer) and  
2. Always draw widget 5 last, however, this still corrupts the widgets - so this really isn't a work-around. 

Neither of these are a good option for me.  Has anyone experienced this? Could anyone offer some advice to help solve 
this problem?

Thanks,
Chris
Re: Drawing Custom Widgets  
I don't know for sure... but it seems to me that perhaps clipping/multiclipping/translations are not properly set/
restored by some of your widgets' draw function. Could you post the code (if it is not too large)?
Re: Drawing Custom Widgets  
Misha,

Thanks for the heads up.  That was exactly the case.  

In my draw function I had a PtClipAdd( widget, &canvas ) function call and it was not followed with a PtClipRemove().  I
 added this function call and all widgets drawn after "widget 5" are now displayed.

Thanks for your quick response.

Chris