Re: [perl-win32-gui-users] Solution: flicker in Win32::GUI

2003-11-16 Thread Jeremy White

From: "Steve Pick" <[EMAIL PROTECTED]>
I've recently been looking into the flickering resize in win32::gui. The
most compatible solution to this I've found is extremely (and very
annoyingly) simple. Just add the style WS_CLIPCHILDREN to your window or
dialog box.


Steve,

I've just tried this and it works...Well, sort of:) On XP, any window behind 
the window being resized tear as they are redrawn. Also, for some reason 
there seems to be a delay in some of the events to any window with 
WS_CLIPCHILDREN set (!?). In my case, it means I can't use WS_CLIPCHILDREN 
which is a shame since the application looks and feels so *much* better 
without the flicker.


Doing a little searching I came across this page 
http://www.catch22.org.uk/tuts/flicker.asp


===
WM_ERASEBKGND
The prime suspect is usually the WM_ERASEBKGND message. This message is sent 
to a window when it's background needs to be erased. This happens because 
windows are usually painted using a 2-stage process:


WM_ERASEBKGND: Clear the background
WM_PAINT: Draw the contents on top



Right then, how do we avoid erasing the background of a window? There are 
two methods.


Set the window's background brush to NULL. (Set the hbrBackground member of 
the WNDCLASS structure to zero when you register the window class).

Return non-zero in the WM_ERASEBKGND message handler.
Any one of these will steps will prevent the WM_ERASEBKGND message from 
clearing the window. The last option is usually easiest to implement:


case WM_ERASEBKGND:
   return 1;
It is also possible to prevent WM_ERASEBKGND when you invalidate and update 
a window. The InvalidateRect API call's last parameter specifies whether or 
not a portion of a window is to have it's background erased when it is next 
redrawn. Specifying FALSE for this paramter prevents WM_ERASEBKGND from 
being sent when the window is redrawn.


InvalidateRect(hwnd, &rect, FALSE);



I've no idea how to write a message handler for WM_ERASEBKGND - any ideas? 
I've played with InvalidateRect in the past but didn't get anywhere fast.



I tried to implement double-buffering in GUI.xs (I was working with 0.0.558
at the time) but frankly I failed.


Have a look at some of the code in this page:

http://www.codeproject.com/gdi/flickerfree.asp

"This article presents a class called CMemDC that encapsulates most of the 
issues associated with writing to off-screen buffers. Adding CMemDC to an 
existing application or MFC Active X control is nearly trivial.


Modifying an MFC Application to use CMemDC
Add the file memdc.h in your project.
Add the line #include "memdc.h" to stdafx.h.
Add a windows message handler for WM_ERASEBKGND. "

Would it be hard to incorporate it into GUI.xs somehow? The code is 
opensource.


Cheers,

jez.

_
Find a cheaper internet access deal - choose one to suit you. 
http://www.msn.co.uk/internetaccess





Re: [perl-win32-gui-users] Suggested addition to GUI.XS and some good news

2003-11-16 Thread Jeremy White

From: "Steve Pick" <[EMAIL PROTECTED]>
Can anyone currently maintaining or debugging Win32::GUI add this to 
GUI.xs?

It's a small change that lets you do SetParent() from Perl.


Sounds good - will be usefull for other things to - will help solve some of 
my modal window issues:)



These three modules are all almost complete, so you'll get them soon.
They're all pure perl except for the one mod required for the dockable
windows to work. Soon you'll be able to create slick apps *fast* :)


Can't wait. Nice work.

Cheers,

jez.

_
On the move? Get Hotmail on your mobile phone http://www.msn.co.uk/msnmobile




Re: [perl-win32-gui-users] Solution: flicker in Win32::GUI

2003-11-16 Thread Steve Pick
Hi,

In my previous message I explained how to stop flickering in Win32::GUI. It
turns out that this technique regularly causes widgets to leave imprints
behind. Imprints dont seem to be left if widgets dont overlap, though.

As I mentioned before I was already looking at painting off-screen, but I
can't seem to get it to work. To solve this problem completely, Win32::GUI
should do *all* painting in WM_PAINT. rather than painting individual
widgets as they change size, and should ignore WM_ERASEBKGND messages. I
tried to implement this, but I'm having trouble navigating the Win32::GUI
source.

If anyone wants to take on the flickering problem I'd be happy to help out
with it.

Steve

- Original Message - 
From: "Steve Pick" <[EMAIL PROTECTED]>
To: "Win32 GUI" 
Sent: Saturday, November 15, 2003 7:00 PM
Subject: [perl-win32-gui-users] Solution: flicker in Win32::GUI


> Hi,
>
> I've recently been looking into the flickering resize in win32::gui. The
> most compatible solution to this I've found is extremely (and very
> annoyingly) simple. Just add the style WS_CLIPCHILDREN to your window or
> dialog box.
>
> I tried to implement double-buffering in GUI.xs (I was working with
0.0.558
> at the time) but frankly I failed.
>
> Steve
>
>
>
> ---
> This SF. Net email is sponsored by: GoToMyPC
> GoToMyPC is the fast, easy and secure way to access your computer from
> any Web browser or wireless device. Click here to Try it Free!
> https://www.gotomypc.com/tr/OSDN/AW/Q4_2003/t/g22lp?Target=mm/g22lp.tmpl
> ___
> Perl-Win32-GUI-Users mailing list
> Perl-Win32-GUI-Users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
>




Re: [perl-win32-gui-users] Solution: flicker in Win32::GUI

2003-11-16 Thread Steve Pick
Hi Jez,

What you said about WM_ERASEBKGND is true, but the results are similar to
setting WS_CLIPCHILDREN. If you block WM_ERASEBKGND messages in the
NEM_WindowMsgLoop function in GUI_MessageLoops.cpp by adding something like:

if(uMsg == WM_ERASEBKGND) return (LRESULT)1;

You get huuuge amounts of streaking whenever anything is painted (obviously,
because the background-erase is there so that this doesnt happen).

That link is interesting, I'll give it a try.

Thanks,

Steve

- Original Message - 
From: "Jeremy White" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; 
Sent: Sunday, November 16, 2003 5:16 PM
Subject: Re: [perl-win32-gui-users] Solution: flicker in Win32::GUI


> >From: "Steve Pick" <[EMAIL PROTECTED]>
> >I've recently been looking into the flickering resize in win32::gui. The
> >most compatible solution to this I've found is extremely (and very
> >annoyingly) simple. Just add the style WS_CLIPCHILDREN to your window or
> >dialog box.
>
> Steve,
>
> I've just tried this and it works...Well, sort of:) On XP, any window
behind
> the window being resized tear as they are redrawn. Also, for some reason
> there seems to be a delay in some of the events to any window with
> WS_CLIPCHILDREN set (!?). In my case, it means I can't use WS_CLIPCHILDREN
> which is a shame since the application looks and feels so *much* better
> without the flicker.
>
> Doing a little searching I came across this page
> http://www.catch22.org.uk/tuts/flicker.asp
>
> ===
> WM_ERASEBKGND
> The prime suspect is usually the WM_ERASEBKGND message. This message is
sent
> to a window when it's background needs to be erased. This happens because
> windows are usually painted using a 2-stage process:
>
> WM_ERASEBKGND: Clear the background
> WM_PAINT: Draw the contents on top
>
> 
>
> Right then, how do we avoid erasing the background of a window? There are
> two methods.
>
> Set the window's background brush to NULL. (Set the hbrBackground member
of
> the WNDCLASS structure to zero when you register the window class).
> Return non-zero in the WM_ERASEBKGND message handler.
> Any one of these will steps will prevent the WM_ERASEBKGND message from
> clearing the window. The last option is usually easiest to implement:
>
> case WM_ERASEBKGND:
> return 1;
> It is also possible to prevent WM_ERASEBKGND when you invalidate and
update
> a window. The InvalidateRect API call's last parameter specifies whether
or
> not a portion of a window is to have it's background erased when it is
next
> redrawn. Specifying FALSE for this paramter prevents WM_ERASEBKGND from
> being sent when the window is redrawn.
>
> InvalidateRect(hwnd, &rect, FALSE);
>
> 
>
> I've no idea how to write a message handler for WM_ERASEBKGND - any ideas?
> I've played with InvalidateRect in the past but didn't get anywhere fast.
>
> >I tried to implement double-buffering in GUI.xs (I was working with
0.0.558
> >at the time) but frankly I failed.
>
> Have a look at some of the code in this page:
>
> http://www.codeproject.com/gdi/flickerfree.asp
>
> "This article presents a class called CMemDC that encapsulates most of the
> issues associated with writing to off-screen buffers. Adding CMemDC to an
> existing application or MFC Active X control is nearly trivial.
>
> Modifying an MFC Application to use CMemDC
> Add the file memdc.h in your project.
> Add the line #include "memdc.h" to stdafx.h.
> Add a windows message handler for WM_ERASEBKGND. "
>
> Would it be hard to incorporate it into GUI.xs somehow? The code is
> opensource.
>
> Cheers,
>
> jez.
>
> _
> Find a cheaper internet access deal - choose one to suit you.
> http://www.msn.co.uk/internetaccess
>
>
>
> ---
> This SF. Net email is sponsored by: GoToMyPC
> GoToMyPC is the fast, easy and secure way to access your computer from
> any Web browser or wireless device. Click here to Try it Free!
> https://www.gotomypc.com/tr/OSDN/AW/Q4_2003/t/g22lp?Target=mm/g22lp.tmpl
> ___
> Perl-Win32-GUI-Users mailing list
> Perl-Win32-GUI-Users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
>




Re: [perl-win32-gui-users] Solution: flicker in Win32::GUI

2003-11-16 Thread Steve Pick
Jeremy,

> Doing a little searching I came across this page
> http://www.catch22.org.uk/tuts/flicker.asp

The page gives good advice and does exactly what I've already done with
double-buffering. However the problem is that double buffering requires that
widgets are drawn when the main window receives WM_PAINT. Win32::GUI by
default doesnt seem to handle WM_PAINT at all in the window event loop, and
widgets all seem to be drawn somewhere else, and I'm not experienced enough
to fix that.

> Have a look at some of the code in this page:
>
> http://www.codeproject.com/gdi/flickerfree.asp

I dont think I can use this, it seems to do exactly what I've already tried
to implement with my own code, but it doesnt look like it's for drawing
*widgets*. While it claims that converting an MFC app to flickerless mode is
"easy" it actually looks too difficult for me to do it with Win32::GUI, for
exactly the same reason as given above; I cant find where widgets are drawn.

Steve

- Original Message - 
From: "Jeremy White" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; 
Sent: Sunday, November 16, 2003 5:16 PM
Subject: Re: [perl-win32-gui-users] Solution: flicker in Win32::GUI


> >From: "Steve Pick" <[EMAIL PROTECTED]>
> >I've recently been looking into the flickering resize in win32::gui. The
> >most compatible solution to this I've found is extremely (and very
> >annoyingly) simple. Just add the style WS_CLIPCHILDREN to your window or
> >dialog box.
>
> Steve,
>
> I've just tried this and it works...Well, sort of:) On XP, any window
behind
> the window being resized tear as they are redrawn. Also, for some reason
> there seems to be a delay in some of the events to any window with
> WS_CLIPCHILDREN set (!?). In my case, it means I can't use WS_CLIPCHILDREN
> which is a shame since the application looks and feels so *much* better
> without the flicker.
>
> Doing a little searching I came across this page
> http://www.catch22.org.uk/tuts/flicker.asp
>
> ===
> WM_ERASEBKGND
> The prime suspect is usually the WM_ERASEBKGND message. This message is
sent
> to a window when it's background needs to be erased. This happens because
> windows are usually painted using a 2-stage process:
>
> WM_ERASEBKGND: Clear the background
> WM_PAINT: Draw the contents on top
>
> 
>
> Right then, how do we avoid erasing the background of a window? There are
> two methods.
>
> Set the window's background brush to NULL. (Set the hbrBackground member
of
> the WNDCLASS structure to zero when you register the window class).
> Return non-zero in the WM_ERASEBKGND message handler.
> Any one of these will steps will prevent the WM_ERASEBKGND message from
> clearing the window. The last option is usually easiest to implement:
>
> case WM_ERASEBKGND:
> return 1;
> It is also possible to prevent WM_ERASEBKGND when you invalidate and
update
> a window. The InvalidateRect API call's last parameter specifies whether
or
> not a portion of a window is to have it's background erased when it is
next
> redrawn. Specifying FALSE for this paramter prevents WM_ERASEBKGND from
> being sent when the window is redrawn.
>
> InvalidateRect(hwnd, &rect, FALSE);
>
> 
>
> I've no idea how to write a message handler for WM_ERASEBKGND - any ideas?
> I've played with InvalidateRect in the past but didn't get anywhere fast.
>
> >I tried to implement double-buffering in GUI.xs (I was working with
0.0.558
> >at the time) but frankly I failed.
>
> Have a look at some of the code in this page:
>
> http://www.codeproject.com/gdi/flickerfree.asp
>
> "This article presents a class called CMemDC that encapsulates most of the
> issues associated with writing to off-screen buffers. Adding CMemDC to an
> existing application or MFC Active X control is nearly trivial.
>
> Modifying an MFC Application to use CMemDC
> Add the file memdc.h in your project.
> Add the line #include "memdc.h" to stdafx.h.
> Add a windows message handler for WM_ERASEBKGND. "
>
> Would it be hard to incorporate it into GUI.xs somehow? The code is
> opensource.
>
> Cheers,
>
> jez.
>
> _
> Find a cheaper internet access deal - choose one to suit you.
> http://www.msn.co.uk/internetaccess
>
>
>
> ---
> This SF. Net email is sponsored by: GoToMyPC
> GoToMyPC is the fast, easy and secure way to access your computer from
> any Web browser or wireless device. Click here to Try it Free!
> https://www.gotomypc.com/tr/OSDN/AW/Q4_2003/t/g22lp?Target=mm/g22lp.tmpl
> ___
> Perl-Win32-GUI-Users mailing list
> Perl-Win32-GUI-Users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
>