ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/trunk/examples/ibtreeview/Unit1.pas
(Generate patch)

Comparing ibx/trunk/examples/ibtreeview/Unit1.pas (file contents):
Revision 142 by tony, Tue Apr 14 13:10:23 2015 UTC vs.
Revision 143 by tony, Fri Feb 23 12:11:21 2018 UTC

# Line 1 | Line 1
1 + (*
2 + *  IBX For Lazarus (Firebird Express)
3 + *
4 + *  The contents of this file are subject to the Initial Developer's
5 + *  Public License Version 1.0 (the "License"); you may not use this
6 + *  file except in compliance with the License. You may obtain a copy
7 + *  of the License here:
8 + *
9 + *    http://www.firebirdsql.org/index.php?op=doc&id=idpl
10 + *
11 + *  Software distributed under the License is distributed on an "AS
12 + *  IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
13 + *  implied. See the License for the specific language governing rights
14 + *  and limitations under the License.
15 + *
16 + *  The Initial Developer of the Original Code is Tony Whyman.
17 + *
18 + *  The Original Code is (C) 2015 Tony Whyman, MWA Software
19 + *  (http://www.mwasoftware.co.uk).
20 + *
21 + *  All Rights Reserved.
22 + *
23 + *  Contributor(s): ______________________________________.
24 + *
25 + *)
26 +            
27   unit Unit1;
28  
29   {$mode objfpc}{$H+}
# Line 27 | Line 53 | type
53      DBEdit3: TDBEdit;
54      DBEdit4: TDBEdit;
55      DepartmentsCHILDCOUNT: TIntegerField;
56 +    DepartmentsIMAGEINDEX: TIBIntegerField;
57      IBDynamicGrid1: TIBDynamicGrid;
58      IBLookupComboEditBox1: TIBLookupComboEditBox;
59      ImageList1: TImageList;
# Line 83 | Line 110 | type
110      procedure DepartmentsAfterDelete(DataSet: TDataSet);
111      procedure DepartmentsAfterInsert(DataSet: TDataSet);
112      procedure DepartmentsAfterTransactionEnd(Sender: TObject);
86    procedure DepartmentsBUDGETChange(Sender: TField);
113      procedure DepartmentsBUDGETGetText(Sender: TField; var aText: string;
114        DisplayText: Boolean);
115      procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
116      procedure FormShow(Sender: TObject);
91    procedure IBTreeView1Addition(Sender: TObject; Node: TTreeNode);
117      procedure IBTreeView1DragDrop(Sender, Source: TObject; X, Y: Integer);
118      procedure IBTreeView1DragOver(Sender, Source: TObject; X, Y: Integer;
119        State: TDragState; var Accept: Boolean);
# Line 98 | Line 123 | type
123      FDirty: boolean;
124      FClosing: boolean;
125      procedure Reopen(Data: PtrInt);
101    procedure SetNodeImage(Node: TTreeNode);
126    public
127      { public declarations }
128    end;
# Line 183 | Line 207 | begin
207      Application.QueueAsyncCall(@Reopen,0);
208   end;
209  
186 procedure TForm1.DepartmentsBUDGETChange(Sender: TField);
187 begin
188  SetNodeImage(IBTreeView1.Selected)
189 end;
190
210   procedure TForm1.DepartmentsBUDGETGetText(Sender: TField; var aText: string;
211    DisplayText: Boolean);
212   begin
# Line 215 | Line 234 | begin
234    Reopen(0);
235   end;
236  
218 procedure TForm1.IBTreeView1Addition(Sender: TObject; Node: TTreeNode);
219 begin
220  SetNodeImage(Node)
221 end;
222
237   procedure TForm1.IBTreeView1DragDrop(Sender, Source: TObject; X, Y: Integer);
238   var Node: TTreeNode;
239      tv: TTreeView;
# Line 266 | Line 280 | begin
280    Staff.Active := true;
281   end;
282  
269 procedure TForm1.SetNodeImage(Node: TTreeNode);
270 begin
271  if Departments.FieldByName('Budget').AsFloat < 500000 then
272     Node.ImageIndex := 0
273  else
274  if Departments.FieldByName('Budget').AsFloat = 500000 then
275    Node.ImageIndex := 2
276  else
277    Node.ImageIndex := 1
278 end;
279
283   end.
284  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines