TTMSFMXPageControl - Hang in loop

Hi,

We encountered a problem when adding an extra page at runtime to a TTMSFMXPageControl.
The program stayed in an eternal loop and never came back.

I took us a long time to be able to reproduce the issue, because some user were experiencing the problem while others not.
Eventually we found out that screen resolution/size was a factor, which gave us a direction to look at.
We traced the problem down to the method TTMSFMXCustomTabSet.ScrollToTab.
Unfortunately I don't have a small test program to reproduce the error.

What do we do?
* The pagecontrol has tabwidth set to autosize
* We are using long texts in the tabs
* Create a new page at runtime
* Set the new page active by using ActivePage := myNewPage

It then ends up in TTMSFMXCustomTabSet.HandleChangeTab before it goes to TTMSFMXCustomTabSet.ScrollToTab.
The code below causes the loop to never end.
(it seems strange that the variables in the condition aren't changed within the loop directly).

procedure TTMSFMXCustomTabSet.ScrollToTab(ATabIndex: Integer);
begin
...
      if ATabIndex > FLastTabIndex then
      begin
        while FLastTabIndex < ATabIndex do
        begin
          Inc(FStartTab);
          if not IsTabVisible(FStartTab) then
            FStartTab := GetNextTab(FStartTab);

          UpdateTabs(False, True);
        end;
      end
...
end;

We think that the problem occurs when a (new) tab just ends on the same pixel as the width of the entire pagecontrol.
This made it hard to reproduce and trace.
The loop keeps setting the FStartTab back and forth then.

Hope you can make anything of my explanation.

Thx
John



We have investigated this here but are currently not able to reproduce this.
Can you please encapsulate this in a small sample so we can investigate the issue here?

Hi Pieter,


I tried to make a small sample program for this, but was not able to reproduce the error with that.
So, it will be hard to test and/or find the issue.
For now I have placed a workaround in our code.

Thx