1. Repaint
- Posted by Renzo Beggia <renzo.beggia at VSK.BE> Oct 31, 2000
- 478 views
Hi, I'm trying to write a large graphical program I use the Transblit function of Win32lib, Layout: a Window with Tabcontrol+items with each a large background BMP where i put small BMP's onto. The problem is : after resizing, minimize or maximize or even when another program overlapped the window, I always have to redraw the Transblitted BMP's myself. Now i use a timer (500 msec)to redraw all the small bmp's, is there another way to redraw them only if needed??? (Repaint events ??) if so , please let me know (a small sample maybe) Thank you, Renzo Beggia from Belgium
2. Re: Repaint
- Posted by Asif Masood Baloch <cyberego at QTA.PAKNET.COM.PK> Oct 31, 2000
- 456 views
- Last edited Nov 01, 2000
Is anyone there?
3. Re: Repaint
- Posted by "Cuny, David at DSS" <David.Cuny at DSS.CA.GOV> Oct 31, 2000
- 456 views
Renzo Beggia wrote: > The problem is : after resizing, minimize or > maximize or even when another program overlapped > the window, I always have to redraw the Transblitted > BMP's myself. There are two seperate events that probably interest you. [onPaint] This is called every time a window needs to be redrawn, either because some hidden portion of the window was either made visible (by maximizing or resizing), or some part of the window was 'damaged' (typically by an overlapping window). [onResize] This is called when a window changes size - minimize, maximize, user resizes. After triggering onResize, Win32Lib will automatically call onPaint, if some portion of the window needs to be redrawn. [Conclusion] If you are drawing to a 'canvas' (bitmap the size of the window), you typically want to trap the onResize event so that you can adjust size of the canvas to the new window size. Otherwise, simply trapping the onPaint event should take care of your problem. -- David Cuny
4. Re: Repaint
- Posted by Gene Mannel <mgene2 at GJ.NET> Nov 01, 2000
- 453 views
On Tue, 31 Oct 2000 06:43:51 -0500, Renzo Beggia <renzo.beggia at VSK.BE> wrote: >Hi, > > >I'm trying to write a large graphical program > >I use the Transblit function of Win32lib, >Layout: a Window with Tabcontrol+items with each a large background BMP > where i put small BMP's onto. >The problem is : after resizing, minimize or maximize or even when another >program overlapped the window, >I always have to redraw the Transblitted BMP's myself. > >Now i use a timer (500 msec)to redraw all the small bmp's, is there another >way to redraw them only if needed??? > >(Repaint events ??) > >if so , please let me know (a small sample maybe) > >Thank you, > >Renzo Beggia >from Belgium Hi Im writing a new program using timer to update the screen also. I was having the same problem to update the screen Then after a bit of experimenting I found if I Killed the timer it worked fine using the following Procedure. Only Im updating the buffer, not the screen itself. When the timer is set again the screen is updated then. And its fast enough. In my case updating the screen didnt work correctly. In your case you may not need to kill the timer. I had to otherwise my 'About' window would be hidden behind the updated screen when about was clicked on. ------------------------------------------------ procedure onPaint_MainWin( integer x1, integer y1, integer x2, integer y2 ) killTimer(MainWin,1) -- Numbers are differant on your program Im sure. -- I use copyBlt(stuff) instead of TransBlt(stuff)as copyBlt() is many times faster. Use CopyBlt anyplace you can to get a bit of extra speed. copyBlt( WinBuff, 6,1, bmp ) setTimer( MainWin, 1, RefreshRate ) end procedure onPaint[MainWin] = routine_id( "onPaint_MainWin" ) ------------------------------------------------ Hope this helps. Gene P.S. If there is a better way, I'd like to know that too. :>)
5. Re: Repaint
- Posted by Ray Smith <smithr at IX.NET.AU> Nov 01, 2000
- 441 views
- Last edited Nov 02, 2000
On Wed, 1 Nov 2000 16:43:56 -0500, Gene Mannel <mgene2 at GJ.NET> wrote: Have you checked out pretend.exw in Win32lib? This is the famous Mr Cuny's version of defender (well the start of it anyway. The timer event is the proceudre that blits the buffer to the screen, and the onPaint just blits the buffer to the screen. In the little game I started making a few weeks ago I set a flag to disable the update of the screen if I was in pause mode. The timer was still active. so just put set for example update_screen = 0 when you don't want the screen updated, then in the start of your timer procedure put: if update_screen != 1 then return end if then you won't have to worry about disabling the timer. I don't know if it's better or worse ... but it seemed to work for me. Ray Smith > I was having the same problem to update the >screen Then after a bit of experimenting I found if >I Killed the timer it worked fine using the following >Procedure. >Only Im updating the buffer, not the screen itself. When >the timer is set again the screen is updated then. And its fast enough. > >In my case updating the screen didnt work correctly. > >In your case you may not need to kill the timer. I had to >otherwise my 'About' window would be hidden behind the updated screen >when about was clicked on. > >------------------------------------------------ >procedure onPaint_MainWin( integer x1, integer y1, integer x2, integer y2 ) > > killTimer(MainWin,1) > > -- Numbers are differant on your program Im sure. > -- I use copyBlt(stuff) instead of TransBlt(stuff)as copyBlt() is many >times faster. Use CopyBlt anyplace you can to get a bit of extra speed. > > copyBlt( WinBuff, 6,1, bmp ) > > setTimer( MainWin, 1, RefreshRate ) > >end procedure > >onPaint[MainWin] = routine_id( "onPaint_MainWin" ) >------------------------------------------------ > > Hope this helps. > > Gene > > > P.S. If there is a better way, I'd like to know that too. :>)
6. Re: Repaint
- Posted by Gene Mannel <mgene2 at GJ.NET> Nov 02, 2000
- 445 views
On Wed, 1 Nov 2000 19:39:46 -0500, Ray Smith <smithr at IX.NET.AU> wrote: >On Wed, 1 Nov 2000 16:43:56 -0500, Gene Mannel <mgene2 at GJ.NET> wrote: > >Have you checked out pretend.exw in Win32lib? > -snip Yes, thats where I learned to use timer for this. >so just put set for example update_screen = 0 when you don't want the screen >updated, then in the start of your timer procedure put: > >if update_screen != 1 then > return >end if > snip I'll toy with that and see how it works . It might be better than killing the timer as I am doing now. Although that works fine too. Gene