TChangeTabAction FMX XE7 - what was Embarcadero thinking?

After adding the standard TChangeTabAction action to my action list, I wrote a function like this:

procedure TfrmMain.ChangeTab(TargetTab: TTabItem; Reverse: Boolean = False);
begin
  ChangeTabAction1.Tab := TargetTab;
  ChangeTabAction1.ExecuteTarget(Self);
end;

      

which I call like this:

 ChangeTab(tsNewTemplate) // slides left
 // stuff
 ChangeTab(tsLogin); // slides right

      

and later

ChangeTab(tsNewTemplate, True); // slides left
// stuff
ChangeTab(tsLogin, True); // slides right

      

And I'm still trying to figure out how to add the Reverse = True function to my function!

The problem is that on every call ChangeTabAction1.ExecuteTarget(Self);

, it is ChangeTabAction1.Direction

automatically canceled! (Switchable)

So, when the tab changes from tsStartUp to tsNewTemplate, it shifts left, then shifts right, then left and right, etc.

What I want to do is

ChangeTab(tsNewTemplate) // slides left
// stuff
 ChangeTab(tsLogin); // slides left

      

and later

ChangeTab(tsNewTemplate, True); // slides right
// stuff
ChangeTab(tsLogin, True); // slides right

      

My Tabcontrol app. much more complicated than this simple 3-tier example. I want to be able to control the direction of the shift on command.

The ChangeTabAction1.Direction indicator doesn't make any sense in the usual sense. You cannot set it in the opposite direction and think that it means the opposite of normal. The opposite becomes Normal immediately after executetarget

and vice versa.

procedure TfrmMain.ChangeTab(TargetTab: TTabItem; Reverse: Boolean = False);
begin
    // This keeps the slide direction going the same way
    // It cancels out the automatic reversal of direction
    if ChangeTabAction1.Direction = TTabTransitionDirection.Normal then
      ChangeTabAction1.Direction := TTabTransitionDirection.Reversed
    else
      ChangeTabAction1.Direction := TTabTransitionDirection.Normal; 

      

Perhaps if someone tells me what the Embarcadero designers think here, I can follow their design idea rather than try to get around it.

+3


source to share


1 answer


TTabTransitionDirection.Normal means that changes to tabs with a lower index are done left-to-right, while changes to higher-indexed tabs are made from right to left. TTabTransitionDirection.Reversed means, well, the opposite.



+1


source







All Articles