Sorry for the format. The next turns I will look for to be more careful
and to conform me to the used format.
(to change more than 20 years of way of write in an only time is enough
complicated)
Vincent Snijders ha scritto:
Guadagnini David schreef:
You could explain better
Index: forms.pp
===================================================================
--- forms.pp (revision 10810)
+++ forms.pp (working copy)
@@ -498,6 +498,7 @@
procedure RemoveHandlerCreate(OnCreateHandler: TNotifyEvent);
function IsShortcut(var Message: TLMKey): boolean; virtual;
procedure IntfHelp(AComponent: TComponent);
+ Function IncludeForm(Control : TWinControl) : Boolean;
public
// drag and dock
procedure Dock(NewDockSite: TWinControl; ARect: TRect); override;
Why use 'Function' and not 'function'as the surrounding code does?
Index: include/customform.inc
===================================================================
--- include/customform.inc (revision 10810)
+++ include/customform.inc (working copy)
@@ -841,12 +841,40 @@
end;
{------------------------------------------------------------------------------
+ procedure TCustomForm.IncludeForm;
+------------------------------------------------------------------------------}
+Function TCustomForm.IncludeForm(Control : TWinControl) : Boolean;
+Var
+ I : Integer;
+ Ok : Boolean;
+Begin
+ Ok := False;
+ If Control <> Nil Then
+ Begin
+ I := 1;
+ While (I <= Control.ControlCount) And (Not Ok) Do
+ Begin
+ If (Control.Controls[I-1] Is TCustomForm) Then
+ Begin
+ Ok := True;
+ End
+ Else
+ If (Control.Controls[I-1] Is TWinControl)
+ Then
+ Ok := IncludeForm(Control.Controls[I-1] As
TWinControl);
+ Inc(I);
+ End;
+ End;
+ Result := Ok;
+End;
+
This is the most important change. But formatted in a way completely
different from the rest of the code.
+{------------------------------------------------------------------------------
TCustomForm WndProc
------------------------------------------------------------------------------}
procedure TCustomForm.WndProc(Var TheMessage : TLMessage);
var
FocusHandle : HWND;
- MenuItem : TMenuItem;
+ MenuItem : TMenuItem;
This change is unnessary and therefore makes the patch more difficult
to read.
begin
with TheMessage do
case Msg of
@@ -868,7 +896,7 @@
and not FActiveControl.ParentDestroyingHandle
then begin
// get or create handle of FActiveControl
- FocusHandle := FActiveControl.Handle;
+ FocusHandle := FActiveControl.Handle;
//debugln('TCustomForm.WndProc A ',DbgSName(Self),'
FActiveControl=',DbgSName(FActiveControl),'
FocusHandle=',dbgs(FocusHandle));
end;
end;
This change is unnessary and therefore makes the patch more difficult
to read.
@@ -880,7 +908,10 @@
DebugLn('[TCustomForm.WndProc] ',Name,':',ClassName);
{$ENDIF}
LCLIntf.SetFocus(FocusHandle);
- Exit;
+
+ If Not IncludeForm(Self) Then Exit;
+
+ LCLIntf.SetFocus(Self.Handle);
end;
end;
end;
Ah, finally a usefull change again, except for the strange
capitalization if if', not, then and exit.
@@ -1570,12 +1601,13 @@
// update Screen object
Screen.FActiveControl := Control;
Screen.FActiveCustomForm := Self;
+
Screen.MoveFormToFocusFront(Self);
if Self is TForm then
- Screen.FActiveForm := TForm(Self)
+ Screen.FActiveForm := TForm(Self)
else
- Screen.FActiveForm := nil;
-
+ Screen.FActiveForm := nil;
+
{$IFDEF VerboseFocus}
DbgOut('TCustomForm.SetFocusedControl Self=',DbgSName(Self));
DbgOut(' Control=',DbgSName(Control),'
Control.HandleAllocated=',dbgs(Control.HandleAllocated));
Did anything change in this hunk or are there just some spaces added?
So in short, this patch not only contained changed functionality, but
also some (IMHO unnessary) format changes. But I don't want to review
a patch based on the format changes, but on real changes. Maybe
Mattias can see through these differences (the bug is assigned to him).
Vincent
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives
begin:vcard
fn:David Guadagnini
n:Guadagnini;David
org:Biotecnica Instruments S.p.A.;R&D
adr:;;Via Licenza 18;Roma;RM;00133;Italy
email;internet:[EMAIL PROTECTED]
title:Software architet
tel;work:+39064112616
x-mozilla-html:FALSE
version:2.1
end:vcard