[lazarus] Some bug fixes for LCL
Andreas Hausladen (Uni)
Andreas.Hausladen at informatik.uni-ulm.de
Sun Nov 9 18:32:37 EST 2003
I have ported the LCL to Delphi 6. While porting I found some bugs in the LCL. Here are the fixes:
--
Regards,
Andreas Hausladen
(JVCL developer)
(http://www.kylix-patch.de.vu)
=======================================================
GraphMath.pp:
=======================================================
Function CenterPoint(Rect : TRect) : TPoint;
var
Tmp : Longint;
begin
With Rect do begin
If Right < Left then begin
Tmp := Right;
Right := Left;
Left := Tmp;
end;
If Bottom < Top then begin
Tmp := Bottom;
Bottom := Top;
******************
Top := Bottom; <-- must be "Top := Tmp;"
******************
end;
Result.X := Left + (Right - Left) div 2;
Result.Y := Top + (Bottom - Top) div 2;
end;
end;
=======================================================
Screen.inc:
=======================================================
procedure NotifyOnActiveControlChanged;
var
i: Integer;
Handler: TScreenControlEvent;
begin
if Assigned(FOnActiveControlChange) then FOnActiveControlChange(Self);
i:=GetHandlerCount(snActiveControlChanged);
while GetNextHandlerIndex(snActiveControlChanged,i) do begin
********************
Handler:=TScreenFormEvent(FHandlers[snActiveControlChanged][i]);
<-- "TScreenFormEvent" must be "TScreenControlEvent"
********************
Handler(Self,FLastActiveControl);
end;
end;
=======================================================
CustomNotebook.inc:
=======================================================
procedure TNBPages.Insert(Index: Integer; const S: String);
var
tmpPage: TCustomPage;
NewOwner: TComponent;
begin
{$IFDEF NOTEBOOK_DEBUG}
writeln('TNBPages.Insert A ',fNoteBook.Name,' Index=',Index,' S="',S,'"');
{$ENDIF}
NewOwner:=fNotebook.Owner;
if NewOwner=nil then
NewOwner:=fNotebook;
******************
tmpPage := fNotebook.PageClass.Create(fNotebook.Owner);
<--- "fNotebook.Owner" should be "NewOwner"
******************
...
procedure TNBPages.Move(CurIndex, NewIndex: Integer);
var
APage: TCustomPage;
Msg: TLMNotebookEvent;
NewControlIndex, NewPageIndex: integer;
begin
if CurIndex=NewIndex then exit;
*****************
NewPageIndex := fNoteBook.PageIndex; <--- inserted
*****************
APage:=TCustomPage(fPageList[CurIndex]);
=======================================================
CommCtrl.pas
=======================================================
TB_ADDSTRINGW = WM_USER = 77;
<--- must be "WM_USER + 77;"
The following code fixes a "WM_DESTROY" AccessViolation
=======================================================
Win32Callback.inc
=======================================================
Function PropEnumProc(Window: Hwnd; Str: PChar; Data: Handle): LongBool; StdCall;
Begin
******************
if (DWORD(Str) and $FFFF0000) = 0 then Exit; // global atom handle
******************
Assert(False, 'Trace:PropEnumProc - Start');
Assert(False, Format('Trace:PropEnumProc - Property %S (with value 0x%X) from window 0x%X removed', [String(Str), Data, Window]));
More information about the Lazarus
mailing list