WB3D forced repaint event?

Blitz3D Forums/Blitz3D Userlibs/WB3D forced repaint event?

Danny(Posted 2008) [#1]
I've been looking for something like this for ages..
Is there a way in wb3d /win32api to force a window's contents or a specific gadget to be 'repainted'?

I build complex custom windows with numerous gadgets. So I need to use wb3d_WB3D_AutoSetGadgetRedraw( window, 0) to disable SEEING gadgets being created, moved, reshaped, etc. Afterwards, I restore it back to '1'.
Without this, the changes to the gadgets would slow things down dramatically. But after this event, the window containing those gadgets won't be properly 'painted' - so the results aren't really 'visible' until you dip the window off screen and back again for example.
Can anyone follow this?! :D

p.s. I'm using WB3D_Strict_GadgetCreation as well, which helps, but not when altering existing gadget's (shapes)..

John Blackledge(Posted 2008) [#2]
Yeah, I follow what you're saying Danny, but I can't find anything like WB3D_AutoSetGadgetRedraw in the help file.

What is the command you are using?

Kev(Posted 2008) [#3]
try the API InvalidateRect function, pass 0 as the lpRect param. it would look like this, it should force the entire client area to be re-drawn.


InvalidateRect can be found in user32.dll

Danny(Posted 2008) [#4]
Thanks Kev, sounds like a good trick! It would be so good if can get this to work, for sure!!

@John; No I don't believe it's in the help files. I use the decls for reference anyway ;) It takes a gadget/window handle and a 'state', setting state 0 seems to turn off the automatic repaint/redraw, whilst state 1 enables it again. How it otherwise behaves or should be used I have no idea - sorry that's all I know on it :D

Thanks again guys,
Next round's on me!


Danny(Posted 2008) [#5]
Shame, it didn't work. Well, that is, I can't seem to call this api_InvalidateRect() without getting a Memory Access Violation..

I've tried:
api_InvalidateRect( SystemProperty("AppHwnd") , 0, True )
api_InvalidateRect( SystemProperty("AppHwnd") , null, True )

with user32.decls:
api_InvalidateRect% (hwnd%, lpRect*, bErase%) : "InvalidateRect"


Kev(Posted 2008) [#6]
in your .decls you define lpRect* as a bank, use an int lpRect%

John Blackledge(Posted 2008) [#7]
My Borland docs for InvalidateRect say:
lpRect: LPRECT type. Points to a RECT data structure that contains the rectangle (in client coordinates) to be added to the update region. If the lpRect parameter is NULL, the entire client area is added to the region.

(Sorry about this Blitz people, bear with us while we ex-C people chunner on.)

Kev(Posted 2008) [#8]
We could pass lpRect as a bank, but it seems unnecessary unless your using the api_InvalidateRect() call else were in your code that requires a bank. using lpRect as an int will enable you to pass a NULL, it would be great if we had a little more control of how decls are defined.

Danny(Posted 2008) [#9]
Unfortunately it didn't have the result I was hoping for. it's unpredictable and too slow..
What still works better is doing a wb3d_StopEvents prior to creating/moving a lot of gadgets followed by wb3d_StartEvents(). That gives a quick and solid refresh, although you can still see some gadgets 'move'/snap into their designated place ..


Kev(Posted 2008) [#10]
What gadgets types are not been rendered correctly, are you defining there style when creating them? can you tell more more danny.