Jump to content

Redraw after window enable


steved

Recommended Posts

I have the following sequence to re-enable a window after my popup has been destroyed:

        gwinSetEnabled(ghFrameScreen, TRUE);
displayFixedScreenItems();

displayFixedScreenItems() shows lines, fixed text etc that aren't window objects.

I found that with the above code, the first fixed screen item wasn't displayed. It turns out that the screen isn't redrawn until after the first fixed item was written, thereby deleting it.

So I modified the code as follows:

        gwinSetEnabled(ghFrameScreen, TRUE);
gwinRedraw(ghFrameScreen); // Needed else first fixed text element not shown
displayFixedScreenItems();

Is this the best way to handle this, or should redraw happen before anything is drawn on the newly enabled screen? (Or maybe I should use a widget to manage my fixed items in some way??)

Link to comment
Share on other sites

Redraw in most cases occurs on a timer thread which is why you are seeing the behaviour you mention. This by design to keep certain actions particularly quick.

There are some defines which control that behaviour one of which I am sure does all the redraw in a synchronous manner. There are other side effects of using those defines so read the doc on them carefully (or just try them and see what happens).

The solution you have used is actually a good solution and shouldn't create any additional redrawing - just change when they happen.

Link to comment
Share on other sites

The other way (and probably the best way) is to create a generic GWindow object and use the gwin drawing calls to draw on that window rather than the gdisp drawing calls.

THe gwin drawing calls ensure that the redraw state is up to date before they perform the actual draw.

eg gdispDrawPixel() gets replaced with gwinDrawPixel().

Sorry for the delay in this comment - I wanted to check the code first.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...