Ignore:
Timestamp:
Oct 19, 2010, 7:19:53 AM (14 years ago)
Author:
george
Message:
  • Modified: Error messsage window reworked to use TListView instead of ListBox.
  • Fixed: Focusing caret to position of error message source in code.
  • Fixed: Loading other units during parsing.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/Transpascal/Forms/UMessagesForm.pas

    r67 r69  
    77uses
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
    9   UCoolDocking, UProject, UCompiler;
     9  ComCtrls, UCoolDocking, UProject, UCompiler;
    1010
    1111type
     
    1515  TMessagesForm = class(TForm)
    1616    CoolDockClient1: TCoolDockClient;
    17     ListBoxMessages: TListBox;
     17    ListView1: TListView;
    1818    procedure ListBoxMessagesSelectionChange(Sender: TObject; User: boolean);
     19    procedure ListView1Click(Sender: TObject);
     20    procedure ListView1Data(Sender: TObject; Item: TListItem);
     21    procedure ListView1SelectItem(Sender: TObject; Item: TListItem;
     22      Selected: Boolean);
    1923  private
    2024    { private declarations }
    2125  public
    22     { public declarations }
     26    procedure Reload;
    2327  end;
    2428
     
    3741procedure TMessagesForm.ListBoxMessagesSelectionChange(Sender: TObject;
    3842  User: boolean);
     43begin
     44
     45end;
     46
     47procedure TMessagesForm.ListView1Click(Sender: TObject);
     48begin
     49  ListView1SelectItem(Self, ListView1.Selected, ListView1.Selected.Selected);
     50end;
     51
     52procedure TMessagesForm.ListView1Data(Sender: TObject; Item: TListItem);
     53begin
     54  with MainForm, CodeForm do
     55  with TErrorMessage(Compiler.ErrorMessages[Item.Index]) do begin
     56    Item.Caption := FileName;
     57    Item.Data := Compiler.ErrorMessages[Item.Index];
     58    Item.SubItems.Add(IntToStr(Position.X) + ',' + IntToStr(Position.Y));
     59    Item.SubItems.Add(Text);
     60  end;
     61end;
     62
     63procedure TMessagesForm.ListView1SelectItem(Sender: TObject; Item: TListItem;
     64  Selected: Boolean);
    3965var
    4066  ProjectFile: TProjectFile;
    4167begin
    4268  with MainForm, CodeForm do
    43   if ListBoxMessages.ItemIndex <> -1 then
    44   with TErrorMessage(Compiler.ErrorMessages[ListBoxMessages.ItemIndex]) do begin
     69  if Assigned(ListView1.Selected) then
     70  with TErrorMessage(ListView1.Selected.Data) do begin
    4571    ProjectFile := Project.SearchFile(FileName);
    4672    if Assigned(ProjectFile) then
     
    5278end;
    5379
     80procedure TMessagesForm.Reload;
     81begin
     82  ListView1.Items.Count := MainForm.Compiler.ErrorMessages.Count;
     83  ListView1.Refresh;
     84end;
     85
    5486end.
    5587
Note: See TracChangeset for help on using the changeset viewer.