mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-21 22:19:40 +02:00
LCL: Fix updating list dataset on dblookupcombobox on selection or autocomplete, issue #39343
This commit is contained in:
parent
52f2a8b88f
commit
fef094c56f
@ -862,6 +862,7 @@ Type
|
|||||||
protected
|
protected
|
||||||
procedure DefineProperties(Filer: TFiler); override;
|
procedure DefineProperties(Filer: TFiler); override;
|
||||||
function DoEdit: boolean; override;
|
function DoEdit: boolean; override;
|
||||||
|
procedure DoAutoCompleteSelect; override;
|
||||||
function IsUnbound: boolean;
|
function IsUnbound: boolean;
|
||||||
private
|
private
|
||||||
FLookup: TDBLookup;
|
FLookup: TDBLookup;
|
||||||
|
@ -144,6 +144,12 @@ begin
|
|||||||
inherited DoExit;
|
inherited DoExit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
// this is a select triggered by autocomplete
|
||||||
|
procedure TCustomComboBox.DoAutoCompleteSelect;
|
||||||
|
begin
|
||||||
|
Select;
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Method: TCustomComboBox.SetSorted
|
Method: TCustomComboBox.SetSorted
|
||||||
Params: val - true means "sort" the combo
|
Params: val - true means "sort" the combo
|
||||||
@ -636,7 +642,7 @@ begin
|
|||||||
Text := sResultText;
|
Text := sResultText;
|
||||||
SelStart := iSelStart;
|
SelStart := iSelStart;
|
||||||
SelLength := UTF8Length(Text);
|
SelLength := UTF8Length(Text);
|
||||||
Select;
|
DoAutoCompleteSelect;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -55,8 +55,10 @@ begin
|
|||||||
if IsUnbound then begin
|
if IsUnbound then begin
|
||||||
if FDetectedEvents and DBCBEVENT_CHANGE <> 0 then
|
if FDetectedEvents and DBCBEVENT_CHANGE <> 0 then
|
||||||
DoOnChange;
|
DoOnChange;
|
||||||
if DetectedEvents and DBCBEVENT_SELECT <>0 then
|
if DetectedEvents and DBCBEVENT_SELECT <>0 then begin
|
||||||
|
FLookup.UpdateData(ItemIndex);
|
||||||
DoOnSelect;
|
DoOnSelect;
|
||||||
|
end;
|
||||||
if DetectedEvents and DBCBEVENT_CLOSEUP <>0 then
|
if DetectedEvents and DBCBEVENT_CLOSEUP <>0 then
|
||||||
DoOnCloseUp;
|
DoOnCloseUp;
|
||||||
end
|
end
|
||||||
@ -64,6 +66,14 @@ begin
|
|||||||
Result := inherited DoEdit;
|
Result := inherited DoEdit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TDBLookupComboBox.DoAutoCompleteSelect;
|
||||||
|
begin
|
||||||
|
if IsUnbound then
|
||||||
|
FLookup.UpdateData(ItemIndex)
|
||||||
|
else
|
||||||
|
UpdateData(Self);
|
||||||
|
end;
|
||||||
|
|
||||||
function TDBLookupComboBox.IsUnbound: boolean;
|
function TDBLookupComboBox.IsUnbound: boolean;
|
||||||
begin
|
begin
|
||||||
result := (FDataLink.DataSource=nil) or (DataField='');
|
result := (FDataLink.DataSource=nil) or (DataField='');
|
||||||
|
@ -345,6 +345,7 @@ type
|
|||||||
procedure CreateParams(var Params: TCreateParams); override;
|
procedure CreateParams(var Params: TCreateParams); override;
|
||||||
procedure InitializeWnd; override;
|
procedure InitializeWnd; override;
|
||||||
procedure DestroyWnd; override;
|
procedure DestroyWnd; override;
|
||||||
|
procedure DoAutoCompleteSelect; virtual;
|
||||||
procedure DoEnter; override;
|
procedure DoEnter; override;
|
||||||
procedure DoExit; override;
|
procedure DoExit; override;
|
||||||
procedure DrawItem(Index: Integer; ARect: TRect;
|
procedure DrawItem(Index: Integer; ARect: TRect;
|
||||||
|
Loading…
Reference in New Issue
Block a user