diff --git a/ide/msgview.pp b/ide/msgview.pp index 405b780629..20d3e4328e 100644 --- a/ide/msgview.pp +++ b/ide/msgview.pp @@ -105,8 +105,10 @@ type function GetMessage: string; function GetVisibleItems(Index: integer): TMessageLine; procedure SetLastLineIsProgress(const AValue: boolean); + procedure DoSelectionChange; protected fBlockCount: integer; + FLastSelectedIndex: integer; function GetSelectedLineIndex: integer; procedure SetSelectedLineIndex(const AValue: integer); public @@ -114,7 +116,7 @@ type destructor Destroy; override; procedure DeleteLine(Index: integer); procedure Add(const Msg, CurDir: string; - ProgressLine, VisibleLine: boolean; OriginalIndex: integer); + ProgressLine, VisibleLine: boolean; OriginalIndex: integer); procedure AddMsg(const Msg, CurDir: string; OriginalIndex: integer); procedure AddProgress(const Msg, CurDir: string); procedure AddSeparator; @@ -186,6 +188,7 @@ begin Name := NonModalIDEWindowNames[nmiwMessagesViewName]; FItems := TList.Create; FVisibleItems := TList.Create; + FLastSelectedIndex := -1; Caption := lisMenuViewMessages; @@ -443,9 +446,7 @@ procedure TMessagesView.MessageViewDblClicked(Sender: TObject); begin if not EnvironmentOptions.MsgViewDblClickJumps then exit; - if (MessageView.Items.Count > 0) and (MessageView.SelCount > 0) then - if Assigned(OnSelectionChanged) then - OnSelectionChanged(self); + DoSelectionChange; end; procedure TMessagesView.CopyAllMenuItemClick(Sender: TObject); @@ -469,9 +470,7 @@ procedure TMessagesView.MessageViewClicked(Sender: TObject); begin if EnvironmentOptions.MsgViewDblClickJumps then exit; - if (MessageView.Items.Count > 0) and (MessageView.SelCount > 0) then - if Assigned(OnSelectionChanged) then - OnSelectionChanged(self); + DoSelectionChange; end; procedure TMessagesView.MessagesViewKeyDown(Sender: TObject; var Key: word; @@ -542,6 +541,20 @@ begin FLastLineIsProgress := AValue; end; +procedure TMessagesView.DoSelectionChange; +var + NewSelectedIndex: LongInt; +begin + if (MessageView.Items.Count > 0) and (MessageView.SelCount > 0) then begin + NewSelectedIndex:=GetSelectedLineIndex; + if NewSelectedIndex<>FLastSelectedIndex then begin + FLastSelectedIndex:=NewSelectedIndex; + if Assigned(OnSelectionChanged) then + OnSelectionChanged(Self); + end; + end; +end; + procedure TMessagesView.SetSelectedLineIndex(const AValue: integer); begin MessageView.ItemIndex := AValue; diff --git a/lcl/include/customform.inc b/lcl/include/customform.inc index c334f24885..839f927aac 100644 --- a/lcl/include/customform.inc +++ b/lcl/include/customform.inc @@ -847,9 +847,11 @@ begin and FActiveControl.Visible and FActiveControl.Enabled and ([csLoading,csDestroying]*ComponentState=[]) and not FActiveControl.ParentDestroyingHandle - then + then begin // get or create handle of FActiveControl FocusHandle := FActiveControl.Handle; + //debugln('TCustomForm.WndProc A ',DbgSName(Self),' FActiveControl=',DbgSName(FActiveControl),' FocusHandle=',dbgs(FocusHandle)); + end; end; TheMessage.Result:=0;