GTK3: Enabled resizing notebook children after insertion.

This allows fixing some problems but it is probably just a workaround.

This fix is related to #40713.
This commit is contained in:
Abou Al Montacir 2024-02-07 21:52:10 +01:00
parent 180dcc8888
commit b44cf28194

View File

@ -4774,19 +4774,14 @@ procedure TGtk3NoteBook.InsertPage(ACustomPage: TCustomPage; AIndex: Integer);
var var
Gtk3Page: TGtk3Page; Gtk3Page: TGtk3Page;
AMinSize, ANaturalSize: gint; AMinSize, ANaturalSize: gint;
NB: PGtkNotebook;
begin begin
if IsWidgetOK then if IsWidgetOK then
begin begin
Gtk3Page := TGtk3Page(ACustomPage.Handle); Gtk3Page := TGtk3Page(ACustomPage.Handle);
NB:=PGtkNoteBook(GetContainerWidget); with PGtkNoteBook(GetContainerWidget)^ do begin
NB^.insert_page(Gtk3Page.Widget, Gtk3Page.FPageLabel, AIndex); insert_page(Gtk3Page.Widget, Gtk3Page.FPageLabel, AIndex);
NB^.get_preferred_width(@AMinSize, @ANaturalSize);
NB^.get_preferred_height(@AMinSize, @ANaturalSize);
if (gtk_notebook_get_n_pages(NB) > 1) then
begin
// Check why this give sometimes: Gtk-WARNING: Negative content width -1 (allocation 1, extents 1x1) while allocating gadget (node notebook, owner GtkNotebook) // Check why this give sometimes: Gtk-WARNING: Negative content width -1 (allocation 1, extents 1x1) while allocating gadget (node notebook, owner GtkNotebook)
//NB^.resize_children; resize_children;
end; end;
end; end;
end; end;