mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-12 10:59:20 +02:00
GTK3: Fixed selected item text returned by ComboBox Text property.
We need to use `GtkEntry` for comboboxes with `has_entry = True` and set the `column_id` property. Closes #40706
This commit is contained in:
parent
27bc023a87
commit
1019007853
@ -6754,7 +6754,7 @@ begin
|
|||||||
// PGtkEventBox(Result)^.set_visible_window(True);
|
// PGtkEventBox(Result)^.set_visible_window(True);
|
||||||
end;
|
end;
|
||||||
g_object_unref(ListStore);
|
g_object_unref(ListStore);
|
||||||
|
PGtkComboBox(Result)^.set_id_column(0);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TGtk3ComboBox.EatArrowKeys(const AKey: Word): Boolean;
|
function TGtk3ComboBox.EatArrowKeys(const AKey: Word): Boolean;
|
||||||
@ -6764,15 +6764,29 @@ end;
|
|||||||
|
|
||||||
function TGtk3ComboBox.getText: String;
|
function TGtk3ComboBox.getText: String;
|
||||||
begin
|
begin
|
||||||
Result := inherited getText;
|
Result := '';
|
||||||
if Gtk3IsComboBox(GetContainerWidget) then
|
if Gtk3IsComboBox(GetContainerWidget) then begin
|
||||||
Result := StrPas(PGtkComboBox(GetContainerWidget)^.get_title);
|
with PGtkComboBox(GetContainerWidget)^ do begin
|
||||||
|
if has_entry then begin
|
||||||
|
Result := StrPas(PGtkEntry(get_child)^.Text);
|
||||||
|
end else begin
|
||||||
|
Result := active_id;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TGtk3ComboBox.setText(const AValue: String);
|
procedure TGtk3ComboBox.setText(const AValue: String);
|
||||||
begin
|
begin
|
||||||
if Gtk3IsComboBox(FWidget) then
|
if Gtk3IsComboBox(GetContainerWidget) then begin
|
||||||
PGtkComboBox(GetContainerWidget)^.set_title(PgChar(AValue));
|
with PGtkComboBox(GetContainerWidget)^ do begin
|
||||||
|
if has_entry then begin
|
||||||
|
PGtkEntry(get_child)^.Text := Pgchar(AValue);
|
||||||
|
end else begin
|
||||||
|
//active_id := Pgchar(AValue); TODO: Wait until property becomes writeble
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TGtk3ComboBox.DumpPrivateStructValues(const ADbgEvent: String);
|
procedure TGtk3ComboBox.DumpPrivateStructValues(const ADbgEvent: String);
|
||||||
|
Loading…
Reference in New Issue
Block a user