30 |
|
interface |
31 |
|
|
32 |
|
uses |
33 |
< |
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, DbCtrls, |
34 |
< |
ExtCtrls, IBSQLParser, DB, StdCtrls, IBCustomDataSet; |
33 |
> |
Classes, SysUtils, LCLType, LResources, Forms, Controls, Graphics, Dialogs, DbCtrls, |
34 |
> |
ExtCtrls, IBSQLParser, DB, StdCtrls, IBCustomDataSet, LCLVersion; |
35 |
|
|
36 |
|
type |
37 |
|
|
117 |
|
procedure CheckAndInsert; |
118 |
|
procedure DoEnter; override; |
119 |
|
procedure DoExit; override; |
120 |
+ |
{$if lcl_fullversion >= 2000000} |
121 |
+ |
{Deferred update changes in Lazarus 2.0 stop the combo box working when |
122 |
+ |
the datasource is nil. We thus have to reverse out the changes :(} |
123 |
+ |
function DoEdit: boolean; override; |
124 |
+ |
procedure Change; override; |
125 |
+ |
procedure CloseUp; override; |
126 |
+ |
procedure Select; override; |
127 |
+ |
{$ifend} |
128 |
|
procedure KeyUp(var Key: Word; Shift: TShiftState); override; |
129 |
|
procedure Loaded; override; |
130 |
|
procedure Notification(AComponent: TComponent; Operation: TOperation); override; |
155 |
|
|
156 |
|
implementation |
157 |
|
|
158 |
< |
uses LCLType, Variants, LCLProc, LazUTF8; |
158 |
> |
uses Variants, LCLProc, LazUTF8; |
159 |
|
|
160 |
|
{ TIBLookupControlLink } |
161 |
|
|
509 |
|
procedure TIBLookupComboEditBox.KeyUp(var Key: Word; Shift: TShiftState); |
510 |
|
begin |
511 |
|
inherited KeyUp(Key, Shift); |
504 |
– |
if Key = VK_RETURN then |
505 |
– |
EditingDone |
506 |
– |
else |
512 |
|
if Key = VK_ESCAPE then |
513 |
|
begin |
514 |
|
SelStart := UTF8Length(Text); {Ensure end of line selection} |
586 |
|
FModified := false; |
587 |
|
end; |
588 |
|
|
589 |
+ |
{$if lcl_fullversion >= 2000000} |
590 |
+ |
type |
591 |
+ |
|
592 |
+ |
{ THackedCustomComboBox } |
593 |
+ |
|
594 |
+ |
THackedCustomComboBox = class(TCustomComboBox) |
595 |
+ |
private |
596 |
+ |
procedure CallChange; |
597 |
+ |
end; |
598 |
+ |
|
599 |
+ |
{ THackedCustomComboBox } |
600 |
+ |
|
601 |
+ |
procedure THackedCustomComboBox.CallChange; |
602 |
+ |
begin |
603 |
+ |
inherited Change; |
604 |
+ |
end; |
605 |
+ |
|
606 |
+ |
procedure TIBLookupComboEditBox.Change; |
607 |
+ |
begin |
608 |
+ |
THackedCustomComboBox(self).CallChange; |
609 |
+ |
end; |
610 |
+ |
|
611 |
+ |
procedure TIBLookupComboEditBox.CloseUp; |
612 |
+ |
begin |
613 |
+ |
inherited CloseUp; |
614 |
+ |
inherited DoEdit; |
615 |
+ |
end; |
616 |
+ |
|
617 |
+ |
procedure TIBLookupComboEditBox.Select; |
618 |
+ |
begin |
619 |
+ |
inherited Select; |
620 |
+ |
inherited DoEdit; |
621 |
+ |
end; |
622 |
+ |
|
623 |
+ |
function TIBLookupComboEditBox.DoEdit: boolean; |
624 |
+ |
begin |
625 |
+ |
{DoEdit will swallow characters if no editable Field. Hence, to enabled |
626 |
+ |
writing we must avoid calling the inherited method.} |
627 |
+ |
if IsUnbound then |
628 |
+ |
Result := true |
629 |
+ |
else |
630 |
+ |
Result := inherited DoEdit; |
631 |
+ |
end; |
632 |
+ |
{$ifend} |
633 |
+ |
|
634 |
|
constructor TIBLookupComboEditBox.Create(TheComponent: TComponent); |
635 |
|
begin |
636 |
|
inherited Create(TheComponent); |