Redraw a window

Share your advanced PureBasic knowledge/code with the community.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Redraw a window

Post by BackupUser »

Code updated for 5.20+

Restored from previous forum. Originally posted by GPI.

Sometimes the window must be redraw. For Example, if the window size has changed and the programm change the positions of gadgets. Win98SE destroy the gadged in this case.

so easy redraw the window after the resizegadget():

Code: Select all

rec.rect 
getclientrect_(WindowID(0),@rec) ;Get the window-Size 
invalidaterect_(WindowID(0),@rec,#true) ;add the complete size to the update-list (#True=earse the background) 
updatewindow_(WindowID(0)) ;and update 


PII 333, 256MB, Asus TNT2Ultra 32MB, AWE Gold 64 4MB
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by ebs.

GPI,

I think this is an easier away:

RedrawWindow_(WindowID(), 0, 0, #RDW_INVALIDATE)

You can use #RDW_ERASE | #RDW_INVALIDATE if you want to erase the background too.

Eric

Originally posted by GPI

Sometimes the window must be redraw. For Example, if the window size has changed and the programm change the positions of gadgets. Win98SE destroy the gadged in this case.

so easy redraw the window after the resizegadget():

rec.rect
getclientrect_(WindowID(),@rec) ;Get the window-Size
invalidaterect_(WindowID(),@rec,#true) ;add the complete size to the update-list (#True=earse the background)
updatewindow_(WindowID()) ;and update



PII 333, 256MB, Asus TNT2Ultra 32MB, AWE Gold 64 4MB
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by GPI.

>RedrawWindow_(WindowID(), 0, 0, #RDW_INVALIDATE)

Doesn't work! The Gadgets and the background are destroyed.

PII 333, 256MB, Asus TNT2Ultra 32MB, AWE Gold 64 4MB
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by ebs.

GPI,

It works correctly on a standard window - all the gadgets are redrawn, which is what should happen. Are you using a different style window?

Eric
Originally posted by GPI

>RedrawWindow_(WindowID(), 0, 0, #RDW_INVALIDATE)

Doesn't work! The Gadgets and the background are destroyed.

PII 333, 256MB, Asus TNT2Ultra 32MB, AWE Gold 64 4MB
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by GPI.

@ebs

standard WIN98SE.
I only change the Window-color, Fonts, size, etc. No special software.

Your solution does nothing on WIN98SE.


PII 333, 256MB, Asus TNT2Ultra 32MB, AWE Gold 64 4MB
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by ebs.

GPI,

That's odd! The description of RedrawWindow() in the AllAPI API-Guide says Windows 95 or later, but it might be wrong. If you can, please try one more version and let me know the result:

Code: Select all

RedrawWindow_(WindowID(), 0, 0, 7)
Eric
Originally posted by GPI

@ebs

standard WIN98SE.
I only change the Window-color, Fonts, size, etc. No special software.

Your solution does nothing on WIN98SE.


PII 333, 256MB, Asus TNT2Ultra 32MB, AWE Gold 64 4MB
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by GPI.

RedrawWindow_(WindowID(), 0, 0, 7)

work! Thanks.

Btw: 7 (4+2+1) is the combination of which constants?

PII 333, 256MB, Asus TNT2Ultra 32MB, AWE Gold 64 4MB
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by ebs.

GPI,

Code: Select all

#RDW_ERASE = 4
#RDW_INTERNALPAINT = 2
#RDW_INVALIDATE = 1
Eric
Originally posted by GPI

RedrawWindow_(WindowID(), 0, 0, 7)

work! Thanks.

Btw: 7 (4+2+1) is the combination of which constants?

PII 333, 256MB, Asus TNT2Ultra 32MB, AWE Gold 64 4MB
Post Reply