ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/trunk/examples/lookupcombobox/Unit1.lfm
Revision: 68
Committed: Tue Oct 17 10:07:58 2017 UTC (6 years, 6 months ago) by tony
File size: 16559 byte(s)
Log Message:
IBX: Editor Positioning tidy up
FBINTF: Trap uninitialised SQL parameters on SQL Exec. Avoids Unknown SQL Type errors.
Consistent setting of Modified (SQLParam).

File Contents

# User Rev Content
1 tony 21 object Form1: TForm1
2 tony 68 Left = 616
3 tony 21 Height = 329
4     Top = 256
5     Width = 658
6     Caption = 'IBLookup Combo Box Demo'
7     ClientHeight = 329
8     ClientWidth = 658
9 tony 68 DefaultMonitor = dmPrimary
10 tony 21 OnClose = FormClose
11     OnShow = FormShow
12 tony 68 Position = poScreenCenter
13     LCLVersion = '1.8.0.4'
14 tony 21 object Label1: TLabel
15     Left = 16
16 tony 68 Height = 14
17 tony 21 Top = 16
18 tony 68 Width = 98
19 tony 21 Caption = 'Employee Name'
20     ParentColor = False
21     end
22     object IBLookupComboEditBox1: TIBLookupComboEditBox
23     Left = 16
24 tony 68 Height = 27
25 tony 21 Top = 32
26     Width = 224
27     KeyField = 'EMP_NO'
28     ListField = 'FULL_NAME'
29     ListFieldIndex = 0
30     ListSource = EmployeeSource
31     LookupCache = False
32     ScrollListDataset = True
33     TabOrder = 0
34     AutoInsert = True
35     AutoCompleteText = [cbactEnabled, cbactEndOfLineComplete, cbactRetainPrefixCase, cbactSearchAscending]
36 tony 68 ItemHeight = 0
37 tony 21 KeyPressInterval = 600
38     OnCanAutoInsert = IBLookupComboEditBox1CanAutoInsert
39     end
40     object Label2: TLabel
41     Left = 16
42 tony 68 Height = 14
43 tony 21 Top = 79
44 tony 68 Width = 103
45 tony 21 Caption = 'Employee Details'
46     ParentColor = False
47     end
48     object Panel1: TPanel
49     Left = 19
50     Height = 185
51     Top = 97
52     Width = 623
53     Anchors = [akTop, akLeft, akRight, akBottom]
54     BevelInner = bvLowered
55     BevelOuter = bvLowered
56     ClientHeight = 185
57     ClientWidth = 623
58     TabOrder = 1
59     object Label3: TLabel
60     Left = 14
61 tony 68 Height = 14
62 tony 21 Top = 18
63 tony 68 Width = 64
64 tony 21 Caption = 'First Name'
65     ParentColor = False
66     end
67     object DBEdit1: TDBEdit
68     Left = 14
69 tony 68 Height = 24
70 tony 21 Top = 32
71     Width = 136
72     DataField = 'FIRST_NAME'
73     DataSource = EmployeeSource
74     CharCase = ecNormal
75     MaxLength = 0
76     TabOrder = 0
77     end
78     object Label4: TLabel
79     Left = 168
80 tony 68 Height = 14
81 tony 21 Top = 18
82 tony 68 Width = 64
83 tony 21 Caption = 'Last Name'
84     ParentColor = False
85     end
86     object DBEdit2: TDBEdit
87     Left = 168
88 tony 68 Height = 24
89 tony 21 Top = 32
90     Width = 144
91     DataField = 'LAST_NAME'
92     DataSource = EmployeeSource
93     CharCase = ecNormal
94     MaxLength = 0
95     TabOrder = 1
96     end
97     object Label5: TLabel
98 tony 68 Left = 547
99     Height = 14
100 tony 21 Top = 120
101 tony 68 Width = 24
102 tony 21 Anchors = [akTop, akRight]
103     Caption = 'Ext.'
104     ParentColor = False
105     end
106     object DBEdit3: TDBEdit
107     Left = 547
108 tony 68 Height = 24
109 tony 21 Top = 136
110     Width = 48
111     DataField = 'PHONE_EXT'
112     DataSource = EmployeeSource
113     Anchors = [akTop, akRight]
114     CharCase = ecNormal
115     MaxLength = 0
116 tony 27 TabOrder = 3
117 tony 21 end
118     object Label6: TLabel
119     Left = 16
120 tony 68 Height = 14
121 tony 21 Top = 65
122 tony 68 Width = 56
123 tony 21 Caption = 'Hire Date'
124     ParentColor = False
125     end
126     object Label7: TLabel
127     Left = 172
128 tony 68 Height = 14
129 tony 21 Top = 65
130 tony 68 Width = 37
131 tony 21 Caption = 'Salary'
132     ParentColor = False
133     end
134     object DBEdit4: TDBEdit
135     Left = 168
136 tony 68 Height = 24
137 tony 21 Top = 80
138     Width = 144
139     DataField = 'SALARY'
140     DataSource = EmployeeSource
141     CharCase = ecNormal
142     MaxLength = 0
143 tony 27 TabOrder = 4
144 tony 21 end
145     object Label8: TLabel
146     Left = 392
147 tony 68 Height = 14
148 tony 21 Top = 16
149 tony 68 Width = 51
150 tony 21 Caption = 'Location'
151     ParentColor = False
152     end
153     object Label9: TLabel
154     Left = 331
155 tony 68 Height = 14
156 tony 21 Top = 16
157 tony 68 Width = 36
158 tony 21 Caption = 'Grade'
159     ParentColor = False
160     end
161     object DBComboBox1: TDBComboBox
162     Left = 331
163 tony 68 Height = 25
164 tony 21 Top = 32
165     Width = 53
166     DataField = 'JOB_GRADE'
167     DataSource = EmployeeSource
168 tony 68 ItemHeight = 0
169 tony 21 Items.Strings = (
170     '1'
171     '2'
172     '3'
173     '4'
174     '5'
175     )
176     MaxLength = 0
177     OnCloseUp = DBComboBox1CloseUp
178     Style = csDropDownList
179     TabOrder = 2
180     end
181     object Label10: TLabel
182     Left = 333
183 tony 68 Height = 14
184 tony 21 Top = 65
185 tony 68 Width = 48
186 tony 21 Caption = 'Job Title'
187     ParentColor = False
188     end
189     object Label11: TLabel
190     Left = 17
191 tony 68 Height = 14
192 tony 21 Top = 122
193 tony 68 Width = 73
194 tony 21 Caption = 'Department'
195     ParentColor = False
196     end
197     object DBEdit5: TDBEdit
198     Left = 17
199 tony 68 Height = 24
200 tony 21 Top = 136
201     Width = 495
202     DataField = 'DEPT_PATH'
203     DataSource = EmployeeSource
204     ReadOnly = True
205     Anchors = [akTop, akLeft, akRight]
206     CharCase = ecNormal
207     MaxLength = 0
208 tony 27 TabOrder = 5
209 tony 21 end
210     object SpeedButton1: TSpeedButton
211     Left = 516
212     Height = 25
213     Top = 136
214     Width = 25
215     Anchors = [akTop, akRight]
216     Caption = '...'
217     OnClick = SpeedButton1Click
218     end
219     object IBLookupComboEditBox2: TIBLookupComboEditBox
220     Left = 392
221 tony 45 Height = 23
222 tony 21 Top = 32
223     Width = 203
224     Anchors = [akTop, akLeft, akRight]
225     AutoSize = False
226     DataField = 'JOB_COUNTRY'
227     DataSource = EmployeeSource
228     KeyField = 'COUNTRY'
229     ListField = 'COUNTRY'
230     ListFieldIndex = 0
231     ListSource = CountriesSource
232     LookupCache = False
233     Style = csDropDownList
234 tony 27 TabOrder = 6
235 tony 21 AutoInsert = False
236     AutoCompleteText = [cbactEnabled, cbactEndOfLineComplete, cbactSearchAscending]
237 tony 68 ItemHeight = 0
238 tony 21 end
239     object IBLookupComboEditBox3: TIBLookupComboEditBox
240     Left = 331
241 tony 68 Height = 28
242 tony 21 Top = 82
243     Width = 264
244     Anchors = [akTop, akLeft, akRight]
245     DataField = 'JOB_CODE'
246     DataSource = EmployeeSource
247     KeyField = 'JOB_CODE'
248     ListField = 'JOB_TITLE'
249     ListFieldIndex = 0
250     ListSource = JobCodeSource
251     LookupCache = False
252     Style = csDropDownList
253 tony 27 TabOrder = 7
254 tony 21 AutoInsert = False
255     AutoCompleteText = [cbactEnabled, cbactEndOfLineComplete, cbactSearchAscending]
256 tony 68 ItemHeight = 0
257 tony 21 end
258 tony 27 object IBDateEdit1: TDBDateEdit
259     Left = 17
260 tony 68 Height = 24
261 tony 27 Top = 82
262     Width = 112
263     CalendarDisplaySettings = [dsShowHeadings, dsShowDayNames]
264     DateOrder = doNone
265     ButtonWidth = 23
266     AutoSelect = False
267     NumGlyphs = 1
268     MaxLength = 0
269     TabOrder = 8
270     DataField = 'HIRE_DATE'
271     DataSource = EmployeeSource
272     end
273 tony 21 end
274     object CancelBtn: TButton
275     Left = 567
276     Height = 25
277     Top = 293
278     Width = 75
279     Anchors = [akRight, akBottom]
280     Caption = 'Cancel'
281     OnClick = CancelBtnClick
282     TabOrder = 2
283     end
284     object SaveBtn: TButton
285     Left = 481
286     Height = 25
287     Top = 293
288     Width = 75
289     Anchors = [akRight, akBottom]
290     Caption = 'Save'
291     OnClick = SaveBtnClick
292     TabOrder = 3
293     end
294     object DeleteBtn: TButton
295     Left = 18
296     Height = 25
297     Top = 294
298     Width = 75
299     Anchors = [akLeft, akBottom]
300     Caption = 'Delete'
301     OnClick = DeleteBtnClick
302     TabOrder = 4
303     end
304     object IBDatabase1: TIBDatabase
305 tony 68 Connected = False
306     CreateIfNotExists = False
307 tony 21 AllowStreamedConnected = False
308 tony 27 DatabaseName = 'localhost:employee'
309 tony 21 Params.Strings = (
310 tony 33 'lc_ctype=UTF8'
311 tony 21 'user_name=SYSDBA'
312 tony 45 'user_name=SYSDBA'
313 tony 21 )
314     DefaultTransaction = IBTransaction1
315     IdleTimer = 0
316     TraceFlags = []
317 tony 41 UseDefaultSystemCodePage = False
318 tony 21 left = 328
319     top = 24
320     end
321     object IBTransaction1: TIBTransaction
322     Active = False
323     DefaultDatabase = IBDatabase1
324     left = 296
325     top = 24
326     end
327     object Employees: TIBDataSet
328 tony 68 AllowAutoActivateTransaction = False
329 tony 21 Database = IBDatabase1
330     Transaction = IBTransaction1
331     AfterDelete = EmployeesAfterDelete
332     AfterEdit = EmployeesAfterDelete
333     AfterInsert = EmployeesAfterInsert
334     AfterPost = EmployeesAfterPost
335     BufferChunks = 1000
336     CachedUpdates = False
337     DeleteSQL.Strings = (
338     'Execute Procedure DELETE_EMPLOYEE :EMP_NO'
339     )
340     InsertSQL.Strings = (
341     'Insert Into EMPLOYEE(EMP_NO, FIRST_NAME, LAST_NAME, PHONE_EXT, HIRE_DATE, DEPT_NO, JOB_CODE, JOB_GRADE, JOB_COUNTRY, SALARY)'
342     'Values(:EMP_NO, :FIRST_NAME, :LAST_NAME, :PHONE_EXT, :HIRE_DATE, :DEPT_NO, :JOB_CODE, :JOB_GRADE, :JOB_COUNTRY, :SALARY)'
343     )
344     RefreshSQL.Strings = (
345     'with recursive Depts As ('
346 tony 45 'Select DEPT_NO, DEPARTMENT, HEAD_DEPT, cast(DEPARTMENT as VarChar'
347     '(256)) as DEPT_PATH,'
348 tony 21 'cast(DEPT_NO as VarChar(64)) as DEPT_KEY_PATH'
349     'From DEPARTMENT Where HEAD_DEPT is NULL '
350     'UNION ALL'
351 tony 45 'Select D.DEPT_NO, D.DEPARTMENT,D. HEAD_DEPT, Depts.DEPT_PATH || '' / '' '
352     '|| D.DEPARTMENT as DEPT_PATH,'
353     'Depts.DEPT_KEY_PATH || '';'' || D.DEPT_NO as DEPT_KEY_PATH'
354     'From DEPARTMENT D'
355     'JOIN Depts On D.HEAD_DEPT = Depts.DEPT_NO'
356 tony 21 ')'
357     ''
358 tony 45 'Select A.EMP_NO, A.FIRST_NAME, A.LAST_NAME, A.PHONE_EXT, '
359     'A.HIRE_DATE, A.DEPT_NO, A.JOB_CODE, '
360     'A.JOB_GRADE, A.JOB_COUNTRY, A.SALARY, A.FULL_NAME, D.DEPT_PATH, '
361     'D.DEPT_KEY_PATH'
362 tony 21 'From EMPLOYEE A'
363     'JOIN Depts D On D.DEPT_NO = A.DEPT_NO'
364 tony 45 ''
365 tony 21 'Where A.EMP_NO = :EMP_NO'
366     )
367     SelectSQL.Strings = (
368     'with recursive Depts As ('
369     'Select DEPT_NO, DEPARTMENT, HEAD_DEPT, cast(DEPARTMENT as VarChar(256)) as DEPT_PATH,'
370     'cast(DEPT_NO as VarChar(64)) as DEPT_KEY_PATH'
371     'From DEPARTMENT Where HEAD_DEPT is NULL '
372     'UNION ALL'
373 tony 45 'Select D.DEPT_NO, D.DEPARTMENT,D. HEAD_DEPT, Depts.DEPT_PATH || '' / '' || D.DEPARTMENT as DEPT_PATH,'
374     'Depts.DEPT_KEY_PATH || '';'' || D.DEPT_NO as DEPT_KEY_PATH'
375     'From DEPARTMENT D'
376     'JOIN Depts On D.HEAD_DEPT = Depts.DEPT_NO'
377 tony 21 ')'
378     ''
379     'Select A.EMP_NO, A.FIRST_NAME, A.LAST_NAME, A.PHONE_EXT, A.HIRE_DATE, A.DEPT_NO, A.JOB_CODE, '
380     'A.JOB_GRADE, A.JOB_COUNTRY, A.SALARY, A.FULL_NAME, D.DEPT_PATH, D.DEPT_KEY_PATH'
381     'From EMPLOYEE A'
382     'JOIN Depts D On D.DEPT_NO = A.DEPT_NO'
383 tony 41 'Order by 3 asc'
384 tony 21 )
385     ModifySQL.Strings = (
386     'Update EMPLOYEE A Set '#13#10' A.EMP_NO = :EMP_NO,'#13#10' A.FIRST_NAME = :FIRST_NAME,'#13#10' A.LAST_NAME = :LAST_NAME,'#13#10' A.PHONE_EXT = :PHONE_EXT,'#13#10' A.HIRE_DATE = :HIRE_DATE,'#13#10' A.DEPT_NO = :DEPT_NO,'#13#10' A.JOB_CODE = :JOB_CODE,'#13#10' A.JOB_GRADE = :JOB_GRADE,'#13#10' A.JOB_COUNTRY = :JOB_COUNTRY,'#13#10' A.SALARY = :SALARY'
387     'Where A.EMP_NO = :OLD_EMP_NO'
388     )
389     GeneratorField.Generator = 'EMP_NO_GEN'
390     GeneratorField.Field = 'EMP_NO'
391     GeneratorField.ApplyOnEvent = gaeOnNewRecord
392     GenerateParamNames = False
393 tony 27 DataSetCloseAction = dcSaveChanges
394 tony 21 AfterTransactionEnd = EmployeesAfterTransactionEnd
395     left = 496
396     top = 16
397     object EmployeesEMP_NO: TSmallintField
398     DisplayWidth = 10
399     FieldKind = fkData
400     FieldName = 'EMP_NO'
401     Index = 0
402     LookupCache = False
403     ProviderFlags = [pfInUpdate, pfInWhere]
404     ReadOnly = False
405     Required = True
406     end
407     object EmployeesFIRST_NAME: TIBStringField
408     DisplayWidth = 15
409     FieldKind = fkData
410     FieldName = 'FIRST_NAME'
411     Index = 1
412     LookupCache = False
413     ProviderFlags = [pfInUpdate, pfInWhere]
414     ReadOnly = False
415     Required = True
416     Size = 15
417     end
418     object EmployeesLAST_NAME: TIBStringField
419     DisplayWidth = 20
420     FieldKind = fkData
421     FieldName = 'LAST_NAME'
422     Index = 2
423     LookupCache = False
424     ProviderFlags = [pfInUpdate, pfInWhere]
425     ReadOnly = False
426     Required = True
427     end
428     object EmployeesPHONE_EXT: TIBStringField
429     Alignment = taRightJustify
430     DisplayWidth = 4
431     FieldKind = fkData
432     FieldName = 'PHONE_EXT'
433     Index = 3
434     LookupCache = False
435     ProviderFlags = [pfInUpdate, pfInWhere]
436     ReadOnly = False
437     Required = False
438     Size = 4
439     end
440     object EmployeesHIRE_DATE: TDateTimeField
441     DisplayWidth = 10
442     FieldKind = fkData
443     FieldName = 'HIRE_DATE'
444     Index = 4
445     LookupCache = False
446     ProviderFlags = [pfInUpdate, pfInWhere]
447     ReadOnly = False
448     Required = True
449     end
450     object EmployeesDEPT_NO: TIBStringField
451     DisplayWidth = 3
452     FieldKind = fkData
453     FieldName = 'DEPT_NO'
454     Index = 5
455     LookupCache = False
456     ProviderFlags = [pfInUpdate, pfInWhere]
457     ReadOnly = False
458     Required = True
459     Size = 3
460     end
461     object EmployeesJOB_CODE: TIBStringField
462     DisplayWidth = 5
463     FieldKind = fkData
464     FieldName = 'JOB_CODE'
465     Index = 6
466     LookupCache = False
467     ProviderFlags = [pfInUpdate, pfInWhere]
468     ReadOnly = False
469     Required = True
470     OnChange = EmployeesJOB_CODEChange
471     Size = 5
472     end
473     object EmployeesJOB_GRADE: TSmallintField
474     DisplayWidth = 10
475     FieldKind = fkData
476     FieldName = 'JOB_GRADE'
477     Index = 7
478     LookupCache = False
479     ProviderFlags = [pfInUpdate, pfInWhere]
480     ReadOnly = False
481     Required = True
482     OnChange = EmployeesJOB_GRADEChange
483     end
484     object EmployeesJOB_COUNTRY: TIBStringField
485     DisplayWidth = 15
486     FieldKind = fkData
487     FieldName = 'JOB_COUNTRY'
488     Index = 8
489     LookupCache = False
490     ProviderFlags = [pfInUpdate, pfInWhere]
491     ReadOnly = False
492     Required = True
493     Size = 15
494     end
495     object EmployeesSALARY: TIBBCDField
496     DisplayWidth = 18
497     FieldKind = fkData
498     FieldName = 'SALARY'
499     Index = 9
500     LookupCache = False
501     ProviderFlags = [pfInUpdate, pfInWhere]
502     ReadOnly = False
503     Required = True
504     OnGetText = EmployeesSALARYGetText
505     Precision = 18
506     Currency = False
507     MaxValue = 0
508     MinValue = 0
509     Size = 2
510     end
511     object EmployeesFULL_NAME: TIBStringField
512     DisplayWidth = 37
513     FieldKind = fkData
514     FieldName = 'FULL_NAME'
515     Index = 10
516     LookupCache = False
517     ProviderFlags = [pfInUpdate, pfInWhere]
518     ReadOnly = False
519     Required = False
520     OnChange = EmployeesFULL_NAMEChange
521     Size = 37
522     end
523     object EmployeesDEPT_PATH: TIBStringField
524     DisplayWidth = 256
525     FieldKind = fkData
526     FieldName = 'DEPT_PATH'
527     Index = 11
528     LookupCache = False
529     ProviderFlags = [pfInUpdate, pfInWhere]
530     ReadOnly = False
531     Required = True
532     Size = 256
533     end
534     object EmployeesDEPT_KEY_PATH: TIBStringField
535     DisplayWidth = 64
536     FieldKind = fkData
537     FieldName = 'DEPT_KEY_PATH'
538     Index = 12
539     LookupCache = False
540     ProviderFlags = [pfInUpdate, pfInWhere]
541     ReadOnly = False
542     Required = True
543     Size = 64
544     end
545     end
546     object EmployeeSource: TDataSource
547     DataSet = Employees
548     OnDataChange = EmployeeSourceDataChange
549     left = 462
550     top = 16
551     end
552     object ApplicationProperties1: TApplicationProperties
553     OnIdle = ApplicationProperties1Idle
554     left = 328
555     top = 56
556     end
557     object Countries: TIBQuery
558 tony 68 AllowAutoActivateTransaction = False
559 tony 21 Database = IBDatabase1
560     Transaction = IBTransaction1
561     BeforeOpen = CountriesBeforeOpen
562     BufferChunks = 1000
563     CachedUpdates = False
564     GenerateParamNames = False
565     GeneratorField.ApplyOnEvent = gaeOnNewRecord
566     SQL.Strings = (
567     'Select A.COUNTRY, A.CURRENCY From COUNTRY A'
568     'JOIN JOB J On J.JOB_COUNTRY = A.COUNTRY'
569     'Where J.JOB_CODE = :JOB_CODE and J.JOB_GRADE = :JOB_GRADE'
570     )
571     Params = <
572     item
573     DataType = ftUnknown
574     Name = 'JOB_CODE'
575     ParamType = ptInput
576     end
577     item
578     DataType = ftUnknown
579     Name = 'JOB_GRADE'
580     ParamType = ptInput
581     end>
582 tony 27 DataSetCloseAction = dcDiscardChanges
583 tony 21 left = 425
584     top = 56
585     ParamData = <
586     item
587     DataType = ftUnknown
588     Name = 'JOB_CODE'
589     ParamType = ptInput
590     end
591     item
592     DataType = ftUnknown
593     Name = 'JOB_GRADE'
594     ParamType = ptInput
595     end>
596     end
597     object CountriesSource: TDataSource
598     DataSet = Countries
599     left = 392
600     top = 58
601     end
602     object JobCodes: TIBQuery
603 tony 68 AllowAutoActivateTransaction = False
604 tony 21 Database = IBDatabase1
605     Transaction = IBTransaction1
606     BeforeOpen = JobCodesBeforeOpen
607     BufferChunks = 1000
608     CachedUpdates = False
609     GenerateParamNames = False
610     GeneratorField.ApplyOnEvent = gaeOnNewRecord
611     SQL.Strings = (
612     'Select distinct A.JOB_CODE, A.JOB_TITLE From JOB A'
613     'Where JOB_GRADE = :JOB_GRADE'
614     'order by 2'
615     )
616     Params = <
617     item
618     DataType = ftUnknown
619     Name = 'JOB_GRADE'
620     ParamType = ptInput
621     end>
622 tony 27 DataSetCloseAction = dcDiscardChanges
623 tony 21 left = 425
624     top = 18
625     ParamData = <
626     item
627     DataType = ftUnknown
628     Name = 'JOB_GRADE'
629     ParamType = ptInput
630     end>
631     end
632     object JobCodeSource: TDataSource
633     DataSet = JobCodes
634     left = 392
635     top = 18
636     end
637     end