XP User - 'selfish' request

Discuss development issues and submit patches here
Post Reply
AllenT
Posts: 25
Joined: Thu Oct 28, 2010 3:01 pm

XP User - 'selfish' request

Post by AllenT »

David,

Microsoft has acknowledged a flaw/bug in the ListView control under all versions of XP when appying the LVS_EX_GRIDLINES style (ie. gridlines option). Scrolling, in many cases, gets scrambled, resulting in either missing lines or lines where none should be! I'm sure you've seen examples posted elsewhere, but I have attached one here. The fix apparently has been done in Vista, but a simple (?) fix can be applied to Explorer++ as follows:

On receiving a LVN_ENDSCROLL notification (end of a listview scroll) and testing for XP (necessary?), do the following
  1. get top line using a LVM_GETTOPINDEX message
  2. get page count using a LVM_GETCOUNTPERPAGE message
  3. calculate bottom line from above values
  4. redraw items using a LVM_REDRAWITEMS (requires top, bottom lines)
That's it!

P.S. I am still an XP user. Apparently, according to Wikipedia, XP still has the highest user base. Full blown Windows programming is too hard on my head, but I have implemented the patch in a AutoIt (scripting language) application that I wrote - works fine!
Windows XP gridline bug
Windows XP gridline bug
grid_bug.png (1.72 KiB) Viewed 7291 times
David Erceg
Site Admin
Posts: 933
Joined: Sat Apr 18, 2009 1:46 am

Re: XP User - 'selfish' request

Post by David Erceg »

Hi Allen,

I've definitely seen this bug before. Honestly, I am a little surprised that it managed to slip by Microsoft ;) I'll work on implementing the workaround - out of curiosity, where did you find it?
AllenT
Posts: 25
Joined: Thu Oct 28, 2010 3:01 pm

Re: XP User - 'selfish' request

Post by AllenT »

David,

Wow - don't you ever sleep? Or do you have an alarm rigged to your computer; someone posts a message and "rrrrrnnnnniiiiigggg"!! For a minute I thought you were on Canadian time...

I had seen this a number of times in third party downloaded applications, and realized quite quickly that it was a Microsoft bug - lines would scramble but changing focus to another app, then back (ie. redraw done), would restore them. The web is full of anecdotal posts about this. I don't think it actually slipped by Microsoft - I think it was just a "wait and see" type of thing. Everything they create has an expiry date and maybe they just thought it wasn't worth it. Along the same lines, the free HtmlHelp compiler (Help Workshop) has some dandy bugs, most overcomeable (is that a word?). Support for it ceased long ago. My last little project was a library of help commands for AutoIt - I discovered one of the hhctrl.ocx commands that NEVER DID WORK! It is documented, but a Microsoft post says that it doesn't work and "there are no plans for a fix". That one amused me...

As for the fix, I have to say (chest puffed out) that I played with AutoIt and came up with it on my own. In fairness, though, I have found Delphi workarounds that were similar. My little app is an GUI for a command-line program to create iPod audiobooks - not much software out there for the Windows platform. I figured that somehow refresh was the answer, but that it was only necessary after a scroll, so MSDN's reference page listed all the messages, etc. - LVM_REDRAWITEMS and LVN_ENDSCROLL looked useful, and as a time-saving measure (AutoIt is definitely slower than a compiled app), I threw in the top/bottom calculation. After a little tweaking, it worked!

Try: http://www.codeproject.com/KB/tips/BoxOTricks.aspx for a quick and dirty (similar) approach - #4 at the bottom.

I think many developers use Vista and higher (though the apps run on XP) so they don't see it on their own machine.

BTW - I have been busy on the Help manual; another post should be available in a day or two.

Have a great (long!) day,
Allen
Post Reply