Why blank lines matter

This had me puzzled for a minute: [delphi] program CodeLibrarian; {$R *.res} uses GX_VerDepConst in '..\..\Framework\GX_VerDepConst.pas'; procedure ShowCodeLib; external GExpertsDll; begin ShowCodeLib; end. [/delphi] This is all the code there is to the stand alone Code Librarian tool that comes with GExperts. Then it dawned me. It's much easier to understand if you add a … Continue reading Why blank lines matter

Do not enumerate on TTreeNode.Item

Note to self: Do not enumerate on TTreeNode.Item, it's highly inefficient. Consider this code: [delphi] procedure SelectFocusedControl(_ActCtrl: TWinControl; _Parent: TTreeNode); var j: Integer; CtrlItem: TTreeNode; begin for j := 0 to _Parent.Count - 1 do begin CtrlItem := _Parent.Item[j]; if CtrlItem.Data = _ActCtrl then begin CtrlItem.Selected := true; break; end else SelectFocusedControl(_ActCtrl, CtrlItem); end; end; … Continue reading Do not enumerate on TTreeNode.Item