Ignore:
Timestamp:
Aug 9, 2018, 3:43:27 PM (6 years ago)
Author:
chronos
Message:
  • Modified: Update Common package.
  • Fixed: Remember forms dimensions after application restart.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/generator/Packages/Common/UListViewSort.pas

    r114 r167  
    8181    FOnChange: TNotifyEvent;
    8282    FStringGrid1: TStringGrid;
    83     procedure DoOnKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
    84     procedure DoOnResize(Sender: TObject);
     83    procedure GridDoOnKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
     84    procedure GridDoOnResize(Sender: TObject);
    8585  public
    8686    constructor Create(AOwner: TComponent); override;
     
    110110{ TListViewFilter }
    111111
    112 procedure TListViewFilter.DoOnKeyUp(Sender: TObject; var Key: Word;
     112procedure TListViewFilter.GridDoOnKeyUp(Sender: TObject; var Key: Word;
    113113  Shift: TShiftState);
    114114begin
     
    117117end;
    118118
    119 procedure TListViewFilter.DoOnResize(Sender: TObject);
     119procedure TListViewFilter.GridDoOnResize(Sender: TObject);
    120120begin
    121121  FStringGrid1.DefaultRowHeight := FStringGrid1.Height;
     
    135135  FStringGrid1.Options := [goFixedHorzLine, goFixedVertLine, goVertLine,
    136136    goHorzLine, goRangeSelect, goEditing, goAlwaysShowEditor, goSmoothScroll];
    137   FStringGrid1.OnKeyUp := DoOnKeyUp;
    138   FStringGrid1.OnResize := DoOnResize;
     137  FStringGrid1.OnKeyUp := GridDoOnKeyUp;
     138  FStringGrid1.OnResize := GridDoOnResize;
    139139end;
    140140
     
    142142var
    143143  I: Integer;
     144  R: TRect;
    144145begin
    145146  with FStringGrid1 do begin
    146     //Columns.Clear;
    147147    while Columns.Count > ListView.Columns.Count do Columns.Delete(Columns.Count - 1);
    148148    while Columns.Count < ListView.Columns.Count do Columns.Add;
    149149    for I := 0 to ListView.Columns.Count - 1 do begin
    150150      Columns[I].Width := ListView.Columns[I].Width;
     151      if Selection.Left = I then begin
     152        R := CellRect(I, 0);
     153        Editor.Left := R.Left + 2;
     154        Editor.Width := R.Width - 4;
     155      end;
    151156    end;
    152157  end;
     
    197202  if AMsg.Msg = WM_NOTIFY then
    198203  begin
    199     Code := PHDNotify(vMsgNotify.NMHdr)^.Hdr.Code;
     204    Code := NMHDR(PHDNotify(vMsgNotify.NMHdr)^.Hdr).Code;
    200205    case Code of
    201206      HDN_ENDTRACKA, HDN_ENDTRACKW:
     
    353358  TP1: TPoint;
    354359  XBias, YBias: Integer;
    355   OldColor: TColor;
     360  PenColor: TColor;
     361  BrushColor: TColor;
    356362  BiasTop, BiasLeft: Integer;
    357363  Rect1: TRect;
     
    365371  Item.Left := 0;
    366372  GetCheckBias(XBias, YBias, BiasTop, BiasLeft, ListView);
    367   OldColor := ListView.Canvas.Pen.Color;
     373  PenColor := ListView.Canvas.Pen.Color;
     374  BrushColor := ListView.Canvas.Brush.Color;
    368375  //TP1 := Item.GetPosition;
    369376  lRect := Item.DisplayRect(drBounds); // Windows 7 workaround
     
    377384  ItemLeft := Item.Left;
    378385  ItemLeft := 23; // Windows 7 workaround
    379  
     386
    380387  Rect1.Left := ItemLeft - CheckWidth - BiasLeft + 1 + XBias;
    381388  //ShowMessage(IntToStr(Tp1.Y) + ', ' + IntToStr(BiasTop) + ', ' + IntToStr(XBias));
     
    408415  end;
    409416  //ListView.Canvas.Brush.Color := ListView.Color;
    410   ListView.Canvas.Brush.Color := clWindow;
    411   ListView.Canvas.Pen.Color := OldColor;
     417  ListView.Canvas.Brush.Color := BrushColor;
     418  ListView.Canvas.Pen.Color := PenColor;
    412419end;
    413420
     
    476483    FHeaderHandle := ListView_GetHeader(FListView.Handle);
    477484    for I := 0 to FListView.Columns.Count - 1 do begin
     485      {$push}{$warn 5057 off}
    478486      FillChar(Item, SizeOf(THDItem), 0);
     487      {$pop}
    479488      Item.Mask := HDI_FORMAT;
    480489      Header_GetItem(FHeaderHandle, I, Item);
Note: See TracChangeset for help on using the changeset viewer.