Page 1 of 1

Window/Gadget repaint

Posted: Tue Mar 07, 2006 8:25 pm
by phuckstepp
I have a small app I'm working on that has a rather intensive for...next loop, during this loop I update several text gadgets with information for the user.

The problem is that if the window is obscured in any way the window doesn't get refreshed and only the text gadgets I'm updating show.

I was wondering if there is a way to force certain gadgets or the entire window to repaint/refresh its self without doing and WaitWindowEvent(), as I don't want the rest of the application accessible during the operation.

I'm using PB v4 Beta 5

Thanks for any help in advance.

Posted: Tue Mar 07, 2006 9:25 pm
by Berikco
If you dont need to process events in the long loop, you could maybe do

Code: Select all

While windowevent() : wend
This will flush the event queu and repaint the window

Posted: Tue Mar 07, 2006 9:32 pm
by netmaestro
InvalidateRect_() Api call will force a redraw of the rectangle you pass it. In this way you can redraw small sections of the window. Another thing you can do is call InvalidateRgn_() with a GadgetID instead of a WindowID, passing a null region will force the whole gadget to redraw.

Posted: Wed Mar 08, 2006 9:21 am
by phuckstepp
Thanks for the help.

I'll try those options out and see which works best for me.

Posted: Wed Mar 08, 2006 1:33 pm
by blueznl
i use a flag

in pseudo:

[ code]
if flag = 1
do all that heavy stuff
event = windowevent()
else
event = waitwindowevent() ; no background stuff so feel free to wait
endif
;
; now first handle all events that should be processed even when busy
;
select event
case ..
do whatever
endselect
;
if flag = 1
select event
case ..
do whatever
endselect
endif
;
[/code]