mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-07 07:38:14 +02:00
LCL: not focusing THintWindow on show
git-svn-id: trunk@18474 -
This commit is contained in:
parent
7d60c9649d
commit
204d1aa9b5
@ -455,6 +455,8 @@ end;
|
||||
|
||||
procedure TSynBaseCompletionForm.Deactivate;
|
||||
begin
|
||||
// completion box lost focus
|
||||
// this can happen when a hint window is clicked => ToDo
|
||||
Visible := False;
|
||||
{$IFDEF SYN_LAZARUS}
|
||||
FHint.Visible := False;
|
||||
|
@ -2411,7 +2411,9 @@ var
|
||||
TextS, TextS2: String;
|
||||
LogCaret: TPoint;
|
||||
begin
|
||||
//debugln('TSourceEditor.StartIdentCompletion');
|
||||
{$IFDEF VerboseIDECompletionBox}
|
||||
debugln(['TSourceEditor.StartIdentCompletion JumpToError: ',JumpToError]);
|
||||
{$ENDIF}
|
||||
if (FEditor.ReadOnly) or (CurrentCompletionType<>ctNone) then exit;
|
||||
SourceNotebook.fIdentCompletionJumpToError:=JumpToError;
|
||||
SourceNotebook.CreateCompletionForm;
|
||||
@ -2433,6 +2435,9 @@ begin
|
||||
end;
|
||||
aCompletion.Editor:=FEditor;
|
||||
aCompletion.Execute(TextS2,P.X,P.Y);
|
||||
{$IFDEF VerboseIDECompletionBox}
|
||||
debugln(['TSourceEditor.StartIdentCompletion END aCompletion.TheForm.Visible=',aCompletion.TheForm.Visible]);
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
procedure TSourceEditor.IncreaseIgnoreCodeBufferLock;
|
||||
@ -3160,6 +3165,9 @@ procedure TSourceNotebook.CreateCompletionForm;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
{$IFDEF VerboseIDECompletionBox}
|
||||
debugln(['TSourceNotebook.CreateCompletionForm START ',dbgsname(aCompletion)]);
|
||||
{$ENDIF}
|
||||
// completion form
|
||||
if aCompletion<>nil then exit;
|
||||
aCompletion := TSynCompletion.Create(Self);
|
||||
@ -3676,7 +3684,10 @@ var
|
||||
Editor: TSynEdit;
|
||||
OldCompletionType: TCompletionType;
|
||||
Begin
|
||||
if CurCompletionControl=nil then
|
||||
{$IFDEF VerboseIDECompletionBox}
|
||||
debugln(['TSourceNotebook.ccComplete START']);
|
||||
{$ENDIF}
|
||||
if CurCompletionControl=nil then
|
||||
begin
|
||||
Value := SourceValue;
|
||||
exit;
|
||||
@ -3756,6 +3767,10 @@ Procedure TSourceNotebook.ccCancel(Sender: TObject);
|
||||
// user cancels completion form
|
||||
begin
|
||||
if CurCompletionControl=nil then exit;
|
||||
{$IFDEF VerboseIDECompletionBox}
|
||||
debugln(['TSourceNotebook.ccCancel START']);
|
||||
//debugln(GetStackTrace(true));
|
||||
{$ENDIF}
|
||||
DeactivateCompletionForm;
|
||||
end;
|
||||
|
||||
@ -3769,6 +3784,9 @@ var
|
||||
NewStr: String;
|
||||
CurEdit: TSynEdit;
|
||||
Begin
|
||||
{$IFDEF VerboseIDECompletionBox}
|
||||
debugln(['TSourceNotebook.ccExecute START']);
|
||||
{$ENDIF}
|
||||
CurCompletionControl := Sender as TSynCompletion;
|
||||
S := TStringList.Create;
|
||||
Prefix := CurCompletionControl.CurrentString;
|
||||
|
@ -460,6 +460,7 @@ type
|
||||
FFormBorderStyle: TFormBorderStyle;
|
||||
FActionLists: TList;
|
||||
procedure CMShowingChanged(var Message: TLMessage); message CM_SHOWINGCHANGED;
|
||||
procedure DoShowWindow; dynamic;
|
||||
procedure Activate; dynamic;
|
||||
procedure ActiveChanged; dynamic;
|
||||
procedure BeginFormUpdate;
|
||||
@ -724,6 +725,8 @@ type
|
||||
procedure SetAutoHide(Value : Boolean);
|
||||
procedure AutoHideHint(Sender : TObject);
|
||||
procedure SetHideInterval(Value : Integer);
|
||||
protected
|
||||
procedure DoShowWindow; override;
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
|
@ -392,8 +392,6 @@ end;
|
||||
ShowWindow event handler.
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TCustomForm.WMShowWindow(var message: TLMShowWindow);
|
||||
var
|
||||
NewFocusControl: TWinControl;
|
||||
begin
|
||||
{$IFDEF VerboseFocus}
|
||||
DbgOut('TCustomForm.WMShowWindow A ',Name,':'+ClassName+' fsShowing='+dbgs(fsShowing in FFormState)+' Msg.Show='+dbgs(Message.Show));
|
||||
@ -411,29 +409,7 @@ begin
|
||||
if Message.Status = 0 then
|
||||
begin
|
||||
if Message.Show then begin
|
||||
if (ActiveControl = nil) and (not (csDesigning in ComponentState))
|
||||
and (Parent=nil) then begin
|
||||
// automatically choose a control to focus
|
||||
{$IFDEF VerboseFocus}
|
||||
DebugLn('TCustomForm.WMShowWindow ',DbgSName(Self),' Set ActiveControl := ',DbgSName(FindDefaultForActiveControl));
|
||||
{$ENDIF}
|
||||
ActiveControl := FindDefaultForActiveControl;
|
||||
end;
|
||||
if ([csLoading,csDestroying]*ComponentState=[])
|
||||
and (Parent=nil) then begin
|
||||
NewFocusControl:=FActiveControl;
|
||||
if (NewFocusControl=nil)
|
||||
or (not NewFocusControl.CanFocus)
|
||||
then
|
||||
NewFocusControl:=Self;
|
||||
if NewFocusControl.HandleAllocated and NewFocusControl.IsVisible
|
||||
then begin
|
||||
{$IFDEF VerboseFocus}
|
||||
DebugLn('TCustomForm.WMShowWindow ',DbgSName(Self),' SetFocus NewFocusControl=',DbgSName(NewFocusControl),' FActiveControl=',DbgSName(FActiveControl));
|
||||
{$ENDIF}
|
||||
LCLIntf.SetFocus(NewFocusControl.Handle);
|
||||
end;
|
||||
end;
|
||||
DoShowWindow;
|
||||
end;
|
||||
end;
|
||||
finally
|
||||
@ -482,6 +458,36 @@ begin
|
||||
DoHide;
|
||||
inherited;
|
||||
end;
|
||||
|
||||
procedure TCustomForm.DoShowWindow;
|
||||
var
|
||||
NewFocusControl: TWinControl;
|
||||
begin
|
||||
if (ActiveControl = nil) and (not (csDesigning in ComponentState))
|
||||
and (Parent=nil) then begin
|
||||
// automatically choose a control to focus
|
||||
{$IFDEF VerboseFocus}
|
||||
DebugLn('TCustomForm.DoShowWindow ',DbgSName(Self),' Set ActiveControl := ',DbgSName(FindDefaultForActiveControl));
|
||||
{$ENDIF}
|
||||
ActiveControl := FindDefaultForActiveControl;
|
||||
end;
|
||||
if ([csLoading,csDestroying]*ComponentState=[])
|
||||
and (Parent=nil) then begin
|
||||
NewFocusControl:=FActiveControl;
|
||||
if (NewFocusControl=nil)
|
||||
or (not NewFocusControl.CanFocus)
|
||||
then
|
||||
NewFocusControl:=Self;
|
||||
if NewFocusControl.HandleAllocated and NewFocusControl.IsVisible
|
||||
then begin
|
||||
{$IFDEF VerboseFocus}
|
||||
DebugLn('TCustomForm.DoShowWindow ',DbgSName(Self),' SetFocus NewFocusControl=',DbgSName(NewFocusControl),' FActiveControl=',DbgSName(FActiveControl));
|
||||
{$ENDIF}
|
||||
LCLIntf.SetFocus(NewFocusControl.Handle);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TCustomForm.Activate
|
||||
Params: none
|
||||
|
@ -59,6 +59,18 @@ Begin
|
||||
TCustomTimer(FAutoHideTimer).Interval := FHideInterval;
|
||||
end;
|
||||
|
||||
procedure THintWindow.DoShowWindow;
|
||||
begin
|
||||
if (ActiveControl = nil) and (not (csDesigning in ComponentState))
|
||||
and (Parent=nil) then begin
|
||||
// automatically choose a control to focus
|
||||
{$IFDEF VerboseFocus}
|
||||
DebugLn('THintWindow.WMShowWindow ',DbgSName(Self),' Set ActiveControl := ',DbgSName(FindDefaultForActiveControl));
|
||||
{$ENDIF}
|
||||
ActiveControl := FindDefaultForActiveControl;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure THintWindow.SetAutoHide(Value : Boolean);
|
||||
Begin
|
||||
FAutoHide := Value;
|
||||
|
@ -8620,6 +8620,7 @@ begin
|
||||
{$IfDef VerboseFocus}
|
||||
DebugLn('');
|
||||
debugln('[TGtkWidgetSet.SetFocus] A hWnd=',GetWidgetDebugReport(Widget));
|
||||
//DebugLn(getStackTrace(true));
|
||||
{$EndIf}
|
||||
|
||||
// return the old focus handle
|
||||
|
Loading…
Reference in New Issue
Block a user