Window/Gadget repaint

Just starting out? Need help? Post your questions and find answers here.
phuckstepp
User
User
Posts: 19
Joined: Tue Dec 27, 2005 12:10 pm
Location: United Kingdom
Contact:

Window/Gadget repaint

Post 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.
Berikco
Administrator
Administrator
Posts: 1326
Joined: Wed Apr 23, 2003 7:57 pm
Location: Belgium
Contact:

Post 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
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8452
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post 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.
BERESHEIT
phuckstepp
User
User
Posts: 19
Joined: Tue Dec 27, 2005 12:10 pm
Location: United Kingdom
Contact:

Post by phuckstepp »

Thanks for the help.

I'll try those options out and see which works best for me.
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6172
Joined: Sat May 17, 2003 11:31 am
Contact:

Post 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]
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB - upgrade incoming...)
( The path to enlightenment and the PureBasic Survival Guide right here... )
Post Reply