Changeset 100
- Timestamp:
- Aug 31, 2016, 9:57:15 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/AcronymDecoder.lpi
r97 r100 212 212 <local> 213 213 <FormatVersion Value="1"/> 214 <CommandLineParams Value=""c:\Users\h160817\Projects\fpc\Acronym Decoder\trunk\Example acronyms.adp""/> 214 215 </local> 215 216 </RunParams> -
trunk/Forms/UFormAcronyms.lfm
r85 r100 53 53 object StatusBar1: TStatusBar 54 54 Left = 0 55 Height = 2 856 Top = 53 055 Height = 24 56 Top = 534 57 57 Width = 740 58 58 Panels = < … … 68 68 Left = 0 69 69 Height = 26 70 Top = 50 470 Top = 508 71 71 Width = 740 72 72 Align = alBottom … … 96 96 OnCompareItem = ListViewSort1CompareItem 97 97 OnFilter = ListViewSort1Filter 98 OnColumnWidthChanged = ListViewSort1ColumnWidthChanged 98 99 Column = 0 99 100 Order = soUp -
trunk/Forms/UFormAcronyms.pas
r97 r100 45 45 Selected: Boolean); 46 46 procedure ListViewFilter1Change(Sender: TObject); 47 procedure ListViewSort1ColumnWidthChanged(Sender: TObject); 47 48 function ListViewSort1CompareItem(Item1, Item2: TObject): Integer; 48 49 procedure ListViewSort1Filter(ListViewSort: TListViewSort); … … 235 236 end; 236 237 238 procedure TFormAcronyms.ListViewSort1ColumnWidthChanged(Sender: TObject); 239 begin 240 ListViewFilter1.UpdateFromListView(ListViewAcronyms); 241 end; 242 237 243 function TFormAcronyms.ListViewSort1CompareItem(Item1, Item2: TObject): Integer; 238 244 begin -
trunk/Forms/UFormImportSources.lfm
r85 r100 307 307 OnCompareItem = ListViewSort1CompareItem 308 308 OnFilter = ListViewSort1Filter 309 OnColumnWidthChanged = ListViewSort1ColumnWidthChanged 309 310 Column = 0 310 311 Order = soNone -
trunk/Forms/UFormImportSources.pas
r97 r100 56 56 Selected: Boolean); 57 57 procedure ListViewFilter1Change(Sender: TObject); 58 procedure ListViewSort1ColumnWidthChanged(Sender: TObject); 58 59 function ListViewSort1CompareItem(Item1, Item2: TObject): Integer; 59 60 procedure ListViewSort1Filter(ListViewSort: TListViewSort); … … 128 129 end; 129 130 131 procedure TFormImportSources.ListViewSort1ColumnWidthChanged(Sender: TObject); 132 begin 133 ListViewFilter1.UpdateFromListView(ListView1); 134 end; 135 130 136 function TFormImportSources.ListViewSort1CompareItem(Item1, Item2: TObject 131 137 ): Integer; … … 235 241 var 236 242 NewImportSource: TImportSource; 237 I: Integer;238 243 begin 239 244 if Assigned(ListView1.Selected) then begin -
trunk/Forms/UFormMain.lfm
r97 r100 1 1 object FormMain: TFormMain 2 Left = 6032 Left = 454 3 3 Height = 446 4 Top = 3424 Top = 401 5 5 Width = 782 6 6 Caption = 'Acronym Decoder' 7 ClientHeight = 42 17 ClientHeight = 422 8 8 ClientWidth = 782 9 9 Menu = MainMenu1 … … 17 17 object Panel1: TPanel 18 18 Left = 0 19 Height = 39 519 Height = 396 20 20 Top = 26 21 21 Width = 782 22 22 Align = alClient 23 23 BevelOuter = bvNone 24 ClientHeight = 39 524 ClientHeight = 396 25 25 ClientWidth = 782 26 26 TabOrder = 1 27 27 object CheckBoxExactMath: TCheckBox 28 28 Left = 8 29 Height = 2 429 Height = 21 30 30 Top = 3 31 Width = 10 431 Width = 102 32 32 Caption = 'Exact match' 33 33 OnChange = CheckBoxExactMathChange … … 44 44 object ListViewAcronyms: TListView 45 45 Left = 8 46 Height = 32 346 Height = 324 47 47 Top = 64 48 48 Width = 767 … … 1434 1434 OnCompareItem = ListViewSort1CompareItem 1435 1435 OnFilter = ListViewSort1Filter 1436 OnColumnWidthChanged = ListViewSort1ColumnWidthChanged 1436 1437 Column = 0 1437 1438 Order = soUp -
trunk/Forms/UFormMain.pas
r98 r100 116 116 Selected: Boolean); 117 117 procedure ListViewFilter1Change(Sender: TObject); 118 procedure ListViewSort1ColumnWidthChanged(Sender: TObject); 118 119 function ListViewSort1CompareItem(Item1, Item2: TObject): Integer; 119 120 procedure ListViewSort1Filter(ListViewSort: TListViewSort); … … 452 453 begin 453 454 UpdateAcronymsList; 455 end; 456 457 procedure TFormMain.ListViewSort1ColumnWidthChanged(Sender: TObject); 458 begin 459 ListViewFilter1.UpdateFromListView(ListViewAcronyms); 454 460 end; 455 461 -
trunk/Packages/Common/UListViewSort.pas
r74 r100 18 18 TCompareEvent = function (Item1, Item2: TObject): Integer of object; 19 19 TListFilterEvent = procedure (ListViewSort: TListViewSort) of object; 20 21 { TListViewSort } 20 22 21 23 TListViewSort = class(TComponent) … … 28 30 FColumn: Integer; 29 31 FOrder: TSortOrder; 32 FOldListViewWindowProc: TWndMethod; 33 FOnColumnWidthChanged: TNotifyEvent; 34 procedure DoColumnBeginResize(const AColIndex: Integer); 35 procedure DoColumnResized(const AColIndex: Integer); 36 procedure DoColumnResizing(const AColIndex, AWidth: Integer); 30 37 procedure SetListView(const Value: TListView); 31 38 procedure ColumnClick(Sender: TObject; Column: TListColumn); … … 40 47 procedure SetColumn(const Value: Integer); 41 48 procedure SetOrder(const Value: TSortOrder); 49 procedure NewListViewWindowProc(var AMsg: TMessage); 42 50 public 43 51 List: TListObject; … … 58 66 property OnCustomDraw: TLVCustomDrawItemEvent read FOnCustomDraw 59 67 write FOnCustomDraw; 68 property OnColumnWidthChanged: TNotifyEvent read FOnColumnWidthChanged 69 write FOnColumnWidthChanged; 60 70 property Column: Integer read FColumn write SetColumn; 61 71 property Order: TSortOrder read FOrder write SetOrder; … … 69 79 FStringGrid1: TStringGrid; 70 80 procedure DoOnKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); 81 procedure DoOnResize(Sender: TObject); 71 82 public 72 83 constructor Create(AOwner: TComponent); override; … … 102 113 end; 103 114 115 procedure TListViewFilter.DoOnResize(Sender: TObject); 116 begin 117 FStringGrid1.DefaultRowHeight := FStringGrid1.Height; 118 end; 119 104 120 constructor TListViewFilter.Create(AOwner: TComponent); 105 121 begin … … 116 132 goHorzLine, goRangeSelect, goEditing, goAlwaysShowEditor, goSmoothScroll]; 117 133 FStringGrid1.OnKeyUp := DoOnKeyUp; 134 FStringGrid1.OnResize := DoOnResize; 118 135 end; 119 136 … … 163 180 { TListViewSort } 164 181 182 procedure TListViewSort.NewListViewWindowProc(var AMsg: TMessage); 183 var 184 vColWidth: Integer; 185 vMsgNotify: TWMNotify absolute AMsg; 186 Code: Integer; 187 begin 188 // call the old WindowProc of ListView 189 FOldListViewWindowProc(AMsg); 190 191 // Currently we care only with WM_NOTIFY message 192 if AMsg.Msg = WM_NOTIFY then 193 begin 194 Code := PHDNotify(vMsgNotify.NMHdr)^.Hdr.Code; 195 case Code of 196 HDN_ENDTRACKA, HDN_ENDTRACKW: 197 DoColumnResized(PHDNotify(vMsgNotify.NMHdr)^.Item); 198 199 HDN_BEGINTRACKA, HDN_BEGINTRACKW: 200 DoColumnBeginResize(PHDNotify(vMsgNotify.NMHdr)^.Item); 201 202 HDN_TRACKA, HDN_TRACKW: 203 begin 204 vColWidth := -1; 205 if (PHDNotify(vMsgNotify.NMHdr)^.PItem<>nil) 206 and (PHDNotify(vMsgNotify.NMHdr)^.PItem^.Mask and HDI_WIDTH <> 0) 207 then 208 vColWidth := PHDNotify(vMsgNotify.NMHdr)^.PItem^.cxy; 209 210 DoColumnResizing(PHDNotify(vMsgNotify.NMHdr)^.Item, vColWidth); 211 end; 212 end; 213 end; 214 end; 215 216 procedure TListViewSort.DoColumnBeginResize(const AColIndex: Integer); 217 begin 218 end; 219 220 procedure TListViewSort.DoColumnResizing(const AColIndex, AWidth: Integer); 221 begin 222 end; 223 224 procedure TListViewSort.DoColumnResized(const AColIndex: Integer); 225 begin 226 if Assigned(FOnColumnWidthChanged) then 227 FOnColumnWidthChanged(Self); 228 end; 165 229 166 230 procedure TListViewSort.ColumnClick(Sender: TObject; Column: TListColumn); … … 189 253 procedure TListViewSort.SetListView(const Value: TListView); 190 254 begin 255 if FListView = Value then Exit; 256 if Assigned(FListView) then 257 ListView.WindowProc := FOldListViewWindowProc; 191 258 FListView := Value; 192 259 FListView.OnColumnClick := ColumnClick; 193 260 FListView.OnCustomDrawItem := ListViewCustomDrawItem; 194 261 FListView.OnClick := ListViewClick; 262 FOldListViewWindowProc := FListView.WindowProc; 263 FListView.WindowProc := NewListViewWindowProc; 195 264 end; 196 265
Note:
See TracChangeset
for help on using the changeset viewer.