My application is hidding and showing toolbars depending of the page displayed. After showing the toolbars they don't display at the same location defined at design time. How can I do to place the toolbars always at the same location or same order ?
We cannot replicate this here, can you show us the code you are using?
procedure TMainForm.ShowHideIcons;
var
PageActive:Boolean;
begin
PageActive:=PageControlSynoptics.ActivePage<>nil;
ControlButtonClosePage.Visible:=PageActive;
ToolBarButtonSave.Visible:=PageActive;
ToolBarButtonSaveAs.Visible:=PageActive;
RibbonToolBarPanAndZoom.Visible:=PageActive;
RibbonToolBarGrid.Visible:=PageActive;
RibbonToolbarTools.Visible:=PageActive;
RibbonToolBarStrokeSettings.Visible:=PageActive;
RibbonToolBarFillSettings.Visible:=PageActive;
RibbonToolBarFontSettings.Visible:=PageActive;
if PageActive then
begin
RefreshIcons;
end;
end;
hi,
We have investigated this here but couldn't immediately detect an issue by toggling the visibility of the controls. Can you provide a simple sample that reproduces the positioning issue?
Hello,
Attached you will find a sample project using the ribbon.
Thanks for your help.
Jean-Noël
Src.zip (191 KB)
Hi,
Thank you for your sample. With the sample, we cannot see any issue. Clicking on the Create button creates a sub panel with a treeview and some other content, the controls remain on the correct position. Clicking on the close button, see attachment for a video.
2020-10-21_15-32-17.zip (713.8 KB)
Hello,
My problem is shown in the video you send me:
The positions of the tabs at runtime are not the same as the one defined at design time, hence my question: how to force the position same as design time ?
My Bad, it was not exactly clear to me that was the issue, I was looking at the top bar icons and header.
The alignment is quite a challenge in FMX, especially when you are manually showing and hiding controls. To make sure they are correctly aligned, you need to specify a Left position:
procedure TMainForm.ShowHideIcons;
var
PageActive:Boolean;
begin
PageActive:=PageControlSynoptics.ActivePage<>nil;
ControlButtonClosePage.Visible:=PageActive;
ToolBarButtonSave.Visible:=PageActive;
ToolBarButtonSaveAs.Visible:=PageActive;
RibbonToolBarPanAndZoom.Visible:=PageActive;
RibbonToolBarGrid.Visible:=PageActive;
RibbonToolbarTools.Visible:=PageActive;
RibbonToolBarStrokeSettings.Visible:=PageActive;
RibbonToolBarFillSettings.Visible:=PageActive;
RibbonToolBarFontSettings.Visible:=PageActive;
RibbonToolBarFontSettings.ControlAlignment := caNone;
RibbonToolBarFillSettings.ControlAlignment := caNone;
RibbonToolBarStrokeSettings.ControlAlignment := caNone;
RibbonToolbarTools.ControlAlignment := caNone;
RibbonToolBarGrid.ControlAlignment := caNone;
RibbonToolBarPanAndZoom.ControlAlignment := caNone;
RibbonToolbarTools.Left := 6;
RibbonToolBarFontSettings.Left := 5;
RibbonToolBarFillSettings.Left := 4;
RibbonToolBarStrokeSettings.Left := 3;
RibbonToolBarGrid.Left := 2;
RibbonToolBarPanAndZoom.Left := 1;
RibbonToolbarTools.ControlAlignment := caLeft;
RibbonToolBarFontSettings.ControlAlignment := caLeft;
RibbonToolBarFillSettings.ControlAlignment := caLeft;
RibbonToolBarStrokeSettings.ControlAlignment := caLeft;
RibbonToolBarGrid.ControlAlignment := caLeft;
RibbonToolBarPanAndZoom.ControlAlignment := caLeft;
if PageActive then
begin
RefreshIcons;
end;
end;
Thank you
Welcome