Jeremy White wrote:
(1) It appears that the '-background' option was never intended to work with windows (Win32::GUI::Window, Win32::GUI::Dialog) and that the only way to change the background colour of a window is using the -class option with a coloured brush. It might be possible to extend the WM_PAINT and/or WM_ERASEBKGND handlers to cope with this - is it work exploring?

I've just had a look at the Visual .Net environment and you can specify the backcolor of a window (and the background image)

It would be possible to allow the -background option to take a Win32::GUI::Brush as a value. This would allow bitmaps as patterns for the background; but it would start to be very confusing for controls, where -background also specifies the text background colour. I don't propose to do this - if you really want it use a class.

The problem with using a class to set the background is that you can't change it during runtime.

I hadn't spotted this.

Setting the background of a window does seem to crop up now and again - and I've been stung with it several times - so a solution would be nice - but how much work would be involved with the fiddling of WM_PAINT/WM_ERASEBKGND? Is there a risk of it breaking other things? Performance?

From what I've seen I don't think it would be hard, but I would be concerned about regression testing, as I don't yet have enough experience in this area to be confident of understanding the behaviour of everything.

Performance - you'd only take a hit if you had the -background option set, and the background needs erasing anyway - it's just a question of whether Win32::GUI does it of it's done by DefWindowProc.

I'll have a look at implementing this.

BTW I've got the fix for class backgrounds not working in perl's 5.8 and higher.

Regards,
Rob.

Reply via email to