Board index » delphi » TListView Custom Draw Integer Overflow Error

TListView Custom Draw Integer Overflow Error

I'm using a TListView to let the user match up to different fields in
different databases.  I allow them to choose a key field which makes the
text in the row show in red and bold.  This worked perfectly fine in Delphi
5 and now I am using Delphi 6 and get the error message that just says
"Integer Overflow" and once it pops up, it will keep doing so until the
program is closed. The error pops up every time it draws an item.  I put
break points on every event of the listview and it never even hits them.

Any help would be appreciated.

Thanks,
Scott

 

Re:TListView Custom Draw Integer Overflow Error


Turn off "integer overflow checking" in compiler options.
For example, this is perfectly valid code but fails with above mentioned
check:
var A : integer;
begin
for A := 0 to Query.Params.Count-1 do
....
end;
This fails if count is zero, because count is always non-negative so it's
declared as unsigned integer.

--
Robert

Quote
Scott Kominek wrote in message <3cd6af3b_2@dnews>...
>I'm using a TListView to let the user match up to different fields in
>different databases.  I allow them to choose a key field which makes the
>text in the row show in red and bold.  This worked perfectly fine in Delphi
>5 and now I am using Delphi 6 and get the error message that just says
>"Integer Overflow" and once it pops up, it will keep doing so until the
>program is closed. The error pops up every time it draws an item.  I put
>break points on every event of the listview and it never even hits them.

>Any help would be appreciated.

>Thanks,
>Scott

Re:TListView Custom Draw Integer Overflow Error


I found the problem in ComCtrls.pas.

Line 14219 of ComCtrls.pas was: and ( FOurFont + FStockFont <> 0 ) then
so I changed it to: and ( Int64(FOurFont) + Int64(FStockFont) <> 0 ) then

The 2 integers added together would be way bigger than a MaxInt when I
changed the colors if the font so now the number can't overflow now.

Scott

Other Threads