-
Notifications
You must be signed in to change notification settings - Fork 33
/
HGM.Controls.Edit.pas
853 lines (760 loc) · 19.9 KB
/
HGM.Controls.Edit.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
unit HGM.Controls.Edit;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs,
Vcl.StdCtrls, System.Generics.Collections, Vcl.ExtCtrls, System.UITypes,
Vcl.Buttons, Vcl.Mask, HGM.Controls.VirtualTable, HGM.Common;
type
TCentredEdit = class(TMaskEdit)
procedure CreateParams(var Params: TCreateParams); override;
procedure ValidateError; override;
end;
TEditExState = (exsNormal, exsError, exsNotEmpty);
TOnPressEnter = procedure(Sender: TObject; Handled: Boolean) of object;
TEditMode = (emText, emDate, emTime, emNumber, emMask);
TEditEx = class(TCustomPanel)
private
FRightButton: TSpeedButton;
FLeftButton: TSpeedButton;
FEdit: TCentredEdit;
FColor: TColor;
FState: TEditExState;
FOnChange: TNotifyEvent;
FOnEditButtonClick: TNotifyEvent;
FOnClearButtonClick: TNotifyEvent;
FOnPressEnter: TOnPressEnter;
FOnEditKeyPress: TKeyPressEvent;
FEditMode: TEditMode;
FMask: string;
FText: string;
procedure OnEditChange(Sender: TObject);
procedure OnButtonClick(Sender: TObject);
procedure OnEditEnter(Sender: TObject);
procedure OnEditKeyPress(Sender: TObject; var Key: Char);
procedure OnLeftButtonClick(Sender: TObject);
function GetText: string;
procedure SetText(const Value: string);
function GetShowClearButton: Boolean;
procedure SetShowClearButton(const Value: Boolean);
function GetTextHint: string;
procedure SetTextHint(const Value: string);
function GetNumberOnly: Boolean;
procedure SetNumberOnly(const Value: Boolean);
function GetValue: Integer;
procedure SetValue(const Value: Integer);
function GetColor: TColor;
procedure SetColor(const Value: TColor);
function GetShowEditButton: Boolean;
procedure SetShowEditButton(const Value: Boolean);
function GetReadOnly: Boolean;
procedure SetReadOnly(const Value: Boolean);
procedure EditKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure GoToControl(Prev: Boolean);
procedure SetEditMode(const Value: TEditMode);
procedure SetMask(const Value: string);
function GetDate: TDate;
procedure SetDate(const Value: TDate);
function GetAutoSelect: Boolean;
procedure SetAutoSelect(const Value: Boolean);
function GetFont: TFont;
procedure SetFont(const Value: TFont);
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure SetNumber(Value: Integer);
property State: TEditExState read FState;
function Flash: Boolean;
procedure Reset;
procedure SetFocus; override;
property Date: TDate read GetDate write SetDate;
property Value: Integer read GetValue write SetValue;
published
property Align;
property OnExit;
property OnEnter;
property Font: TFont read GetFont write SetFont;
property AutoSelect: Boolean read GetAutoSelect write SetAutoSelect;
property TabOrder;
property ReadOnly: Boolean read GetReadOnly write SetReadOnly;
property Color: TColor read GetColor write SetColor;
property OnChange: TNotifyEvent read FOnChange write FOnChange;
property OnEditButtonClick: TNotifyEvent read FOnEditButtonClick write FOnEditButtonClick;
property OnClearButtonClick: TNotifyEvent read FOnClearButtonClick write FOnClearButtonClick;
property Text: string read GetText write SetText;
property Mode: TEditMode read FEditMode write SetEditMode;
property Mask: string read FMask write SetMask;
property TextHint: string read GetTextHint write SetTextHint;
property OnPressEnter: TOnPressEnter read FOnPressEnter write FOnPressEnter;
property ShowClearButton: Boolean read GetShowClearButton write SetShowClearButton;
property ShowEditButton: Boolean read GetShowEditButton write SetShowEditButton;
property NumberOnly: Boolean read GetNumberOnly write SetNumberOnly;
property OnKeyPress: TKeyPressEvent read FOnEditKeyPress write FOnEditKeyPress;
property Visible;
property Enabled;
end;
TOnGetItemText = procedure(Sender: TObject; Index: Integer; var Value: string) of object;
TlkComboBox = class(TCustomPanel)
private
FItemIndex: Integer;
FListData: TTableEx;
FListButton: TSpeedButton;
FRightButton: TSpeedButton;
FEdit: TCentredEdit;
FOnChange: TNotifyEvent;
FOnGetItemText: TOnGetItemText;
FGetDataProc: TGetTableDataProc;
FViewListSize: Integer;
FViewListWidth: Integer;
//FListWindow:TFormList;
procedure OnEditChange(Sender: TObject);
procedure OnButtonClick(Sender: TObject);
function GetText: string;
procedure SetText(const Value: string);
function GetShowClearButton: Boolean;
procedure SetShowClearButton(const Value: Boolean);
function GetTextHint: string;
procedure SetTextHint(const Value: string);
procedure OnListButtonClick(Sender: TObject);
procedure OnListExit(Sender: TObject);
procedure OnListItemClick(Sender: TObject; MouseButton: TMouseButton; const Index: Integer);
function GetColor: TColor;
procedure SetColor(const Value: TColor);
function GetItemCount: Integer;
procedure SetItemCount(const Value: Integer);
procedure SetGetDataProc(const Value: TGetTableDataProc);
function GetColumnCount: Integer;
function GetColumns: TTableColumns;
procedure SetItemIndex(const Value: Integer);
function GetAutoSelect: Boolean;
procedure SetAutoSelect(const Value: Boolean);
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
function AddColumn: Integer;
procedure DeleteColumn(Index: Integer);
property ColumnCount: Integer read GetColumnCount;
property Columns: TTableColumns read GetColumns;
published
property Align;
property AutoSelect: Boolean read GetAutoSelect write SetAutoSelect;
property ViewListSize: Integer read FViewListSize write FViewListSize;
property ViewListWidth: Integer read FViewListWidth write FViewListWidth default 0;
property ItemCount: Integer read GetItemCount write SetItemCount;
property GetData: TGetTableDataProc read FGetDataProc write SetGetDataProc;
property Color: TColor read GetColor write SetColor;
property OnChange: TNotifyEvent read FOnChange write FOnChange;
property Text: string read GetText write SetText;
property ItemIndex: Integer read FItemIndex write SetItemIndex;
property TextHint: string read GetTextHint write SetTextHint;
property ShowClearButton: Boolean read GetShowClearButton write SetShowClearButton;
property OnGetItemText: TOnGetItemText read FOnGetItemText write FOnGetItemText;
property Visible;
property Enabled;
end;
procedure Register;
implementation
uses
Math;
procedure Register;
begin
RegisterComponents(PackageName, [TEditEx]);
RegisterComponents(PackageName, [TlkComboBox]);
end;
{ TEditEx }
constructor TEditEx.Create(AOwner: TComponent);
begin
inherited;
Width := 200;
Height := 24;
BorderStyle := bsNone;
BevelOuter := bvNone;
Color := $00854F18;
ParentBackground := False;
ParentColor := False;
FEdit := TCentredEdit.Create(Self);
with FEdit do
begin
Align := alClient;
Margins.Left := 1;
Margins.Right := 0;
Margins.Top := 1;
Margins.Bottom := 1;
Font.Size := 10;
BorderStyle := bsNone;
BevelInner := bvRaised;
BevelKind := bkFlat;
BevelWidth := 3;
BevelOuter := bvNone;
AutoSize := False;
AlignWithMargins := True;
OnChange := OnEditChange;
OnKeyPress := OnEditKeyPress;
OnKeyDown := EditKeyDown;
OnEnter := OnEditEnter;
Name := 'Edit';
Parent := Self;
end;
FLeftButton := TSpeedButton.Create(Self);
with FLeftButton do
begin
Caption := '▼';
Font.Name := 'Arial';
Font.Size := 10;
Font.Style := [fsBold];
Font.Color := clWhite;
Align := alRight;
Width := 24;
Flat := True;
Name := 'LeftButton';
OnClick := OnLeftButtonClick;
Parent := Self;
end;
FRightButton := TSpeedButton.Create(Self);
with FRightButton do
begin
Caption := '×';
Font.Name := 'Arial';
Font.Size := 14;
Font.Style := [fsBold];
Font.Color := clWhite;
Align := alRight;
Width := 24;
Flat := True;
Name := 'RightButton';
OnClick := OnButtonClick;
Parent := Self;
end;
ShowClearButton := True;
ShowEditButton := False;
Mode := emText;
FEdit.Text := FText;
end;
destructor TEditEx.Destroy;
begin
inherited;
end;
function TEditEx.Flash: Boolean;
begin
Result := True;
FState := exsError;
inherited Color := clRed;
Application.ProcessMessages;
Sleep(60);
inherited Color := clMaroon;
Application.ProcessMessages;
Sleep(60);
inherited Color := clWhite;
Application.ProcessMessages;
Sleep(60);
inherited Color := clMaroon;
Application.ProcessMessages;
Sleep(60);
inherited Color := clRed;
Application.ProcessMessages;
Sleep(60);
inherited Color := clMaroon;
Application.ProcessMessages;
Sleep(60);
inherited Color := clWhite;
Application.ProcessMessages;
Sleep(60);
inherited Color := clMaroon;
Application.ProcessMessages;
Sleep(60);
inherited Color := clRed;
Application.ProcessMessages;
Sleep(60);
end;
function TEditEx.GetAutoSelect: Boolean;
begin
Result := FEdit.AutoSelect;
end;
function TEditEx.GetColor: TColor;
begin
Result := FColor;
end;
function TEditEx.GetDate: TDate;
var
DT: TDateTime;
begin
if TryStrToDate(FEdit.Text, DT) then
Result := DT
else
Result := -1;
end;
function TEditEx.GetFont: TFont;
begin
Result := FEdit.Font;
end;
function TEditEx.GetNumberOnly: Boolean;
begin
Result := FEdit.NumbersOnly;
end;
function TEditEx.GetReadOnly: Boolean;
begin
Result := FEdit.ReadOnly;
end;
function TEditEx.GetShowClearButton: Boolean;
begin
Result := FRightButton.Visible;
end;
function TEditEx.GetShowEditButton: Boolean;
begin
Result := FLeftButton.Visible;
end;
function TEditEx.GetText: string;
begin
Result := FEdit.Text;
end;
function TEditEx.GetTextHint: string;
begin
Result := FEdit.TextHint;
end;
function TEditEx.GetValue: Integer;
begin
if not TryStrToInt(FEdit.Text, Result) then
Result := -1;
end;
procedure TEditEx.GoToControl(Prev: Boolean);
var
Frm: TCustomForm;
begin
Frm := GetParentForm(TCustomForm(Self));
if Frm = nil then
Exit;
if Prev then
SendMessage(Frm.Handle, WM_NEXTDLGCTL, 1, 0)
else
SendMessage(Frm.Handle, WM_NEXTDLGCTL, 0, 0);
end;
procedure TEditEx.OnButtonClick(Sender: TObject);
begin
if Assigned(FOnClearButtonClick) then
begin
FOnClearButtonClick(Self);
Exit;
end;
if FEdit.Modified then
begin
FEdit.Reset;
Exit;
end;
FEdit.Clear;
end;
procedure TEditEx.OnEditChange(Sender: TObject);
begin
Reset;
if Assigned(FOnChange) then
FOnChange(Self);
end;
procedure TEditEx.OnEditEnter(Sender: TObject);
begin
FEdit.SelectFirst;
end;
procedure TEditEx.OnEditKeyPress(Sender: TObject; var Key: Char);
var
Handled: Boolean;
begin
if (Key = #13) then
begin
Key := #0;
Handled := False;
if Assigned(FOnPressEnter) then
begin
FOnPressEnter(Sender, Handled);
if Handled then
Exit;
end;
GoToControl(False);
end;
if Assigned(FOnEditKeyPress) then
FOnEditKeyPress(Sender, Key);
end;
procedure TEditEx.EditKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
if Key in [VK_UP, VK_LEFT] then
begin
Key := 0;
GoToControl(True);
end
else if Key in [VK_DOWN, VK_RIGHT] then
begin
Key := 0;
GoToControl(False);
end;
end;
procedure TEditEx.OnLeftButtonClick(Sender: TObject);
begin
if Assigned(FOnEditButtonClick) then
FOnEditButtonClick(Self);
end;
procedure TEditEx.Reset;
begin
FState := exsNormal;
inherited Color := FColor;
end;
procedure TEditEx.SetAutoSelect(const Value: Boolean);
begin
FEdit.AutoSelect := Value;
end;
procedure TEditEx.SetColor(const Value: TColor);
begin
FColor := Value;
Reset;
end;
procedure TEditEx.SetDate(const Value: TDate);
begin
if Mode <> emDate then
Exit;
FEdit.Text := FormatDateTime('DD.MM.YYYY', Value)
end;
procedure TEditEx.SetEditMode(const Value: TEditMode);
begin
FEditMode := Value;
FEdit.EditMask := '';
FEdit.Reset;
FEdit.Clear;
case FEditMode of
emText:
begin
NumberOnly := False;
FEdit.EditMask := '';
end;
emDate:
begin
NumberOnly := False;
FEdit.EditMask := '90\.90\.9000;1;_';
end;
emTime:
begin
NumberOnly := False;
FEdit.EditMask := '!90:00;1;_';
end;
emNumber:
begin
NumberOnly := True;
FEdit.EditMask := '';
end;
emMask:
begin
NumberOnly := False;
SetMask(FMask);
end;
end;
end;
procedure TEditEx.SetFocus;
begin
inherited;
FEdit.SetFocus;
end;
procedure TEditEx.SetFont(const Value: TFont);
begin
FEdit.Font := Value;
end;
procedure TEditEx.SetMask(const Value: string);
begin
FMask := Value;
if FEditMode = emMask then
FEdit.EditMask := FMask;
end;
procedure TEditEx.SetNumber(Value: Integer);
begin
FEdit.Text := IntToStr(Value);
end;
procedure TEditEx.SetNumberOnly(const Value: Boolean);
begin
FEdit.NumbersOnly := Value;
end;
procedure TEditEx.SetReadOnly(const Value: Boolean);
begin
FEdit.ReadOnly := Value;
end;
procedure TEditEx.SetShowClearButton(const Value: Boolean);
begin
FRightButton.Visible := Value;
if not FLeftButton.Visible then
if Value then
FEdit.Margins.Right := 0
else
FEdit.Margins.Right := 1;
Repaint;
end;
procedure TEditEx.SetShowEditButton(const Value: Boolean);
begin
FLeftButton.Visible := Value;
if not FRightButton.Visible then
if Value then
FEdit.Margins.Right := 0
else
FEdit.Margins.Right := 1;
Repaint;
end;
procedure TEditEx.SetText(const Value: string);
begin
FText := Value;
FEdit.Text := FText;
end;
procedure TEditEx.SetTextHint(const Value: string);
begin
FEdit.TextHint := Value;
end;
procedure TEditEx.SetValue(const Value: Integer);
begin
if NumberOnly then
SetNumber(Value);
end;
{ TCentredEdit }
procedure TCentredEdit.CreateParams(var Params: TCreateParams);
begin
inherited;
end;
{ TComboBoxEx }
function TlkComboBox.GetAutoSelect: Boolean;
begin
Result := FEdit.AutoSelect;
end;
function TlkComboBox.GetColor: TColor;
begin
Result := inherited Color;
end;
function TlkComboBox.GetColumnCount: Integer;
begin
Result := FListData.ColumnCount;
end;
function TlkComboBox.GetColumns: TTableColumns;
begin
Result := FListData.Columns;
end;
function TlkComboBox.GetItemCount: Integer;
begin
Result := FListData.ItemCount;
end;
function TlkComboBox.GetShowClearButton: Boolean;
begin
Result := FRightButton.Visible;
end;
function TlkComboBox.GetText: string;
begin
Result := FEdit.Text;
end;
function TlkComboBox.GetTextHint: string;
begin
Result := FEdit.TextHint;
end;
procedure TlkComboBox.OnButtonClick(Sender: TObject);
begin
FEdit.Clear;
ItemIndex := -1;
end;
procedure TlkComboBox.OnEditChange(Sender: TObject);
begin
ItemIndex := -1;
if Assigned(FOnChange) then
FOnChange(Self);
end;
procedure TlkComboBox.OnListButtonClick(Sender: TObject);
begin
{
if FListWindow.Visible then
begin
//OnListExit(nil);
end
else
begin
//FListData.Parent:=Self.Parent;
FListWindow.Width:=Self.Width;
FListWindow.Left:=Self.ClientToScreen(Point(0, 0)).X;
FListWindow.Top:=Self.ClientToScreen(Point(0, 0)).Y+Self.Height-1;
FListData.DefaultRowHeight:=Self.Height;
FListData.Height:=Min(FListData.ItemCount, FViewListSize)*FListData.DefaultRowHeight+2;
//FListData.ShowColumns:=False;
FListWindow.Show;
FListWindow.SetFocus;
end; }
if FListData.Visible then
begin
OnListExit(nil);
end
else
begin
FListData.Parent := Self.Parent;
if FViewListWidth <= 0 then
FListData.Width := Self.Width
else
FListData.Width := FViewListWidth;
FListData.Left := Self.Left;
FListData.Top := Self.Top + Self.Height - 1;
FListData.DefaultRowHeight := Self.Height;
FListData.Height := Min(FListData.ItemCount, FViewListSize) * FListData.DefaultRowHeight + 2;
FListData.ShowColumns := False;
FListData.Show;
FListData.BringToFront;
FListData.SetFocus;
end;
end;
procedure TlkComboBox.OnListExit(Sender: TObject);
begin
FListData.Visible := False;
end;
procedure TlkComboBox.SetAutoSelect(const Value: Boolean);
begin
FEdit.AutoSelect := Value;
end;
procedure TlkComboBox.SetColor(const Value: TColor);
begin
inherited Color := Value;
FListData.LineColor := clWhite;
FListData.LineColorXor := clWhite;
FListData.LineSelColor := Value;
end;
procedure TlkComboBox.SetGetDataProc(const Value: TGetTableDataProc);
begin
FGetDataProc := Value;
FListData.GetData := FGetDataProc;
end;
procedure TlkComboBox.SetItemCount(const Value: Integer);
begin
FListData.ItemCount := Value;
end;
procedure TlkComboBox.SetItemIndex(const Value: Integer);
begin
FItemIndex := Value;
if Assigned(FListData) then
FListData.ItemIndex := Value;
end;
procedure TlkComboBox.SetShowClearButton(const Value: Boolean);
begin
FRightButton.Visible := Value;
if Value then
FEdit.Margins.Right := 0
else
FEdit.Margins.Right := 1;
Repaint;
end;
procedure TlkComboBox.SetText(const Value: string);
begin
FEdit.Text := Value;
end;
procedure TlkComboBox.SetTextHint(const Value: string);
begin
FEdit.TextHint := Value;
end;
function TlkComboBox.AddColumn: Integer;
begin
Result := FListData.AddColumn;
end;
constructor TlkComboBox.Create(AOwner: TComponent);
begin
inherited;
Width := 200;
Height := 24;
BorderStyle := bsNone;
BevelOuter := bvNone;
FViewListSize := 10;
FViewListWidth := 0;
ParentBackground := False;
ParentColor := False;
FEdit := TCentredEdit.Create(Self);
with FEdit do
begin
Parent := Self;
Align := alClient;
Margins.Left := 1;
Margins.Right := 0;
Margins.Top := 1;
Margins.Bottom := 1;
Font.Size := 10;
BorderStyle := bsNone;
BevelInner := bvRaised;
BevelKind := bkFlat;
BevelWidth := 3;
BevelOuter := bvNone;
AlignWithMargins := True;
OnChange := OnEditChange;
Name := 'Edit';
Text := '';
end;
FListButton := TSpeedButton.Create(Self);
with FListButton do
begin
Parent := Self;
Caption := '▼';
Font.Name := 'Arial';
Font.Size := 10;
Font.Style := [fsBold];
Font.Color := clWhite;
Align := alRight;
Width := 24;
Flat := True;
Name := 'ListButton';
OnClick := OnListButtonClick;
end;
FRightButton := TSpeedButton.Create(Self);
with FRightButton do
begin
Caption := '×';
Font.Name := 'Arial';
Font.Size := 14;
Font.Style := [fsBold];
Font.Color := clWhite;
Align := alRight;
Width := 24;
Flat := True;
Name := 'Button';
OnClick := OnButtonClick;
Parent := Self;
end;
{FListWindow:=TFormList.Create(nil);
with FListWindow do
begin
Parent:=nil;
Visible:=False;
OnDeactivate:=OnListExit;
end; }
FListData := TTableEx.Create(Self);
//FListData:=FListWindow.TableEx1;
with FListData do
begin
Name := 'FListData';
Parent := Self;
Align := alClient;
ItemCount := 0;
Visible := False;
//ShowColumns:=False;
DefaultRowHeight := 20;
OnExit := OnListExit;
BevelInner := bvNone;
BevelKind := bkFlat;
BorderStyle := bsNone;
OnMouseLeave := OnListExit;
OnItemClick := OnListItemClick;
end;
FListData.Parent := nil;
Color := $00854F18;
ShowClearButton := True;
end;
procedure TlkComboBox.DeleteColumn(Index: Integer);
begin
FListData.DeleteColumn(Index);
end;
destructor TlkComboBox.Destroy;
begin
inherited;
end;
procedure TlkComboBox.OnListItemClick(Sender: TObject; MouseButton: TMouseButton; const Index: Integer);
var
Str: string;
begin
Str := 'Укажите OnGetItemText';
if Assigned(FOnGetItemText) then
FOnGetItemText(Self, Index, Str);
Text := Str;
ItemIndex := Index;
OnListExit(nil);
end;
procedure TCentredEdit.ValidateError;
begin
//inherited;
end;
end.