For Programmers: Free Programming Magazines  


Home > Archive > Clarion > July 2004 > How do you force a Window Repaint?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How do you force a Window Repaint?
Charles Christopher

2004-07-27, 3:55 am

[also posted on http://news.softvelocity.com/]

Below is complete source which implements the code Iv'e seen posted by
several
people. I am unable to get those windows calls to work. As you see
from the
code the SetPixel() data in not cleared by InvalidateRect() &
UpdateWindow(),
however hiding the window then unhiding does force a repaint. The
problem with
using hide is the resulting flashing.

Thus far I've seen no other suggestions as to how to force a window
repaint.

Please help -- I need to eliminate the hide/unhide due to the flashing
it
causes, how to I properly force a window to repait and thus erase the
SetPixel() data and clear out "control footprints"?

Thanks!

Note: I have compiled this code using CW55EE & CW61EE and run app on
Windows 98
and Windows 2000 server

!#######################################
########################################
#############################

Repaint PROGRAM

MAP
MODULE('WINAPI')
GetDC( long hWnd
), long, pascal, raw, name('GetDC' )
SetPixel( long hdc, long XPos, long nYPos,
long crColor
), long, pascal, raw, name('SetPixel' )
DeleteDC( long Hdc
), byte, pascal, raw, name('DeleteDC' )
InvalidateRect( long hWnd, long lpRect, long bErase
), long, pascal, raw, name('InvalidateRect')
UpdateWindow( long hWnd
), long, pascal, raw, name('UpdateWindow' )
Hilario Perez

2004-07-27, 3:55 pm

TRY changing the code to:

CODE

Open(MainWindow)
Display

Accept
if (Event() = Event:OpenWindow ) then
hWnd = ?PlotArea{PROP:Handle} ! <-- Only works for controls,
! does not
!work for window handles as suggested by several posts
myDC = GetDC(hWnd)
Loop I = 1 to 255
Loop J = 1 to 255
SetPixel(myDC, I, J, J)
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com