Open IgitBuh opened 7 years ago
Too long and too complicated issue. Needs to be splitted into 3 requests with simple steps which producing error
Code which testing bug (1) of above requests.
The width of the tabs isn’t initialized correctly if the close button is visible and TabWidthFromContent is set to True. The initial width ignores the close button area, so the text is cut off. After launching the program, one has to move the cursor over the component, then move it out again, then the component fixes all tab widths automatically.
procedure TForm1.EventSetTabWidth(Sender: TObject;
ATabControl: ChromeTabsControls.TChromeTabControl; var TabWidth: Integer);
begin
TestTabWidth := TabWidth;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if Assigned(TestChromeTabs) then
TestChromeTabs.Free;
TestChromeTabs := TChromeTabs.Create(self);
TestChromeTabs.OnSetTabWidth := EventSetTabWidth;
TestChromeTabs.Parent := self;
TestChromeTabs.Left := 8;
TestChromeTabs.Top := 102;
TestChromeTabs.Width := 350;
TestChromeTabs.Options.Display.Tabs.TabWidthFromContent := True;
TestChromeTabs.Tabs.Add.Caption := '1 Tab 1';
TestChromeTabs.Tabs.Add.Caption := '2 Longer tab caption 2';
TestChromeTabs.Tabs.Add.Caption := '3 Tab 3';
(Sender as TButton).Caption := Format('Expected: %d, Actual: %d',
[79, TestTabWidth]);
end;
I'm going to verify this. Check two other cases and register three separate issues. Then we can close this multi-issue. Any comments?
Registered issue #70 with problem described in the point 1:
- The width of the tabs isn’t initialized correctly if the close button is visible and TabWidthFromContent is set to True. The initial width ignores the close button area, so the text is cut off. After launching the program, one has to move the cursor over the component, then move it out again, then the component fixes all tab widths automatically.
Can't reproduce: point 2.
- AutoHideButtons = True causes the scroll buttons to initialize as a tiny area in the top left if there are initially enough tabs to make the scroll buttons visible from the beginning. Moving the cursor over the component and out again fixes their position, but not their state. One has to click the left scroll button to make it disabled (as it should be because you can’t scroll further left).
When I paste provided TChromeTab component then tab are displayed incorrectly, but can produce similar scenarios for code.
First of all let me thank you for this awesome Delphi component! I love how you took care about the smallest details and made this component extremely flexible to use! Having said that, I found some glitches that I'd like to address, hoping you could fix them to make this component even better.
The width of the tabs isn’t initialized correctly if the close button is visible and TabWidthFromContent is set to True. The initial width ignores the close button area, so the text is cut off. After launching the program, one has to move the cursor over the component, then move it out again, then the component fixes all tab widths automatically.
AutoHideButtons = True causes the scroll buttons to initialize as a tiny area in the top left if there are initially enough tabs to make the scroll buttons visible from the beginning. Moving the cursor over the component and out again fixes their position, but not their state. One has to click the left scroll button to make it disabled (as it should be because you can’t scroll further left). Demonstration of 1 and 2:
Closing tab with TabWidthFromContent = True is somewhat buggy. First, the button right from the closed tab changes its size to the closed tab size. Maybe you made this so the user can directly click on the close button of the next tab, but I think it’s wrong to cut the text of the next longer tab just for this. I wish there was an option to keep the widths. Second, closing the tab with enabled scrolling causes a confusing result. Demonstration of 3:
I'd wish there was a procedure to update all positions at any time. Currently this is only triggered when the cursor leaves the component. If there was such a public procedure, one could probably work around some of the problems like these.
I'm using the latest TChromeTabs version. Here's the configuration of the described problems (I've left out the LookAndFeel part because I didn't change anything there):