Ignore:
Timestamp:
Oct 19, 2010, 7:19:53 AM (15 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.
Location:
branches/Transpascal/Forms
Files:
3 edited

Legend:

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

    r67 r69  
    5959    ReopenLastOpenedFile: Boolean;
    6060    procedure OpenRecentClick(Sender: TObject);
    61     procedure LoadErrorMessages;
    6261    procedure DockInit;
    6362    procedure LoadFromRegistry;
     
    112111
    113112  ProjectManager.TreeViewProjectChange(Self, ProjectManager.TreeViewProject.Selected);
    114   LoadErrorMessages;
    115 end;
    116 
    117 procedure TMainForm.LoadErrorMessages;
    118 var
    119   I: Integer;
    120 begin
    121   with MessagesForm do begin
    122     ListBoxMessages.Clear;
    123     for I := 0 to Compiler.ErrorMessages.Count - 1 do
    124     with TErrorMessage(Compiler.ErrorMessages[I]) do
    125       ListBoxMessages.Items.Add(FileName + '(' + IntToStr(Position.X) +
    126         ',' + IntToStr(Position.Y) + ') ' + Text);
    127   end;
     113  MessagesForm.Reload;
    128114end;
    129115
  • branches/Transpascal/Forms/UMessagesForm.lfm

    r64 r69  
    88  ClientWidth = 320
    99  LCLVersion = '0.9.29'
    10   object ListBoxMessages: TListBox
     10  object ListView1: TListView
    1111    Left = 0
    1212    Height = 240
     
    1414    Width = 320
    1515    Align = alClient
    16     ItemHeight = 0
    17     OnSelectionChange = ListBoxMessagesSelectionChange
     16    Columns = <   
     17      item
     18        Caption = 'File'
     19        Width = 80
     20      end   
     21      item
     22        Caption = 'Position'
     23      end   
     24      item
     25        Caption = 'Message'
     26        Width = 500
     27      end>
     28    ItemIndex = -1
     29    OwnerData = True
     30    ReadOnly = True
     31    RowSelect = True
    1832    TabOrder = 0
     33    ViewStyle = vsReport
     34    OnClick = ListView1Click
     35    OnData = ListView1Data
     36    OnSelectItem = ListView1SelectItem
    1937  end
    2038  object CoolDockClient1: TCoolDockClient
  • 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.