Browse Source

+ TCompilerMessageListBox.SelectFirstError

pierre 25 years ago
parent
commit
05fb7d5941
1 changed files with 29 additions and 5 deletions
  1. 29 5
      ide/text/fpcompil.pas

+ 29 - 5
ide/text/fpcompil.pas

@@ -43,7 +43,8 @@ type
 
 
     PCompilerMessageListBox = ^TCompilerMessageListBox;
     PCompilerMessageListBox = ^TCompilerMessageListBox;
     TCompilerMessageListBox = object(TMessageListBox)
     TCompilerMessageListBox = object(TMessageListBox)
-      function GetPalette: PPalette; virtual;
+      function  GetPalette: PPalette; virtual;
+      procedure SelectFirstError;
     end;
     end;
 
 
     PCompilerMessageWindow = ^TCompilerMessageWindow;
     PCompilerMessageWindow = ^TCompilerMessageWindow;
@@ -183,6 +184,22 @@ begin
   GetPalette:=@P;
   GetPalette:=@P;
 end;
 end;
 
 
+procedure TCompilerMessageListBox.SelectFirstError;
+  function IsError(P : PCompilerMessage) : boolean;
+    begin
+      IsError:=(P^.TClass and (V_Fatal or V_Error))<>0;
+    end;
+  var
+    P : PCompilerMessage;
+begin
+  P:=List^.FirstThat(@IsError);
+  If Assigned(P) then
+    Begin
+      FocusItem(List^.IndexOf(P));
+      DrawView;
+    End;
+end;
+
 
 
 {*****************************************************************************
 {*****************************************************************************
                                 TCompilerMessageWindow
                                 TCompilerMessageWindow
@@ -679,10 +696,14 @@ begin
 {$endif TEMPHEAP}
 {$endif TEMPHEAP}
   if Assigned(CompilerMessageWindow) then
   if Assigned(CompilerMessageWindow) then
     with CompilerMessageWindow^ do
     with CompilerMessageWindow^ do
-    if GetState(sfVisible) then
       begin
       begin
-        SetState(sfSelected,false);
-        SetState(sfSelected,true);
+        if GetState(sfVisible) then
+          begin
+            SetState(sfSelected,false);
+            SetState(sfSelected,true);
+          end;
+        if (status.errorCount>0) then
+          MsgLB^.SelectFirstError;
       end;
       end;
   { ^^^ we need this trick to reactivate the desktop }
   { ^^^ we need this trick to reactivate the desktop }
   EditorModified:=false;
   EditorModified:=false;
@@ -742,7 +763,10 @@ end;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.49  2000-01-25 00:26:35  pierre
+  Revision 1.50  2000-02-06 23:41:42  pierre
+   +  TCompilerMessageListBox.SelectFirstError
+
+  Revision 1.49  2000/01/25 00:26:35  pierre
    + Browser info saving
    + Browser info saving
 
 
   Revision 1.48  2000/01/14 15:38:28  pierre
   Revision 1.48  2000/01/14 15:38:28  pierre