Have an amazing solution built in RAD Studio? Let us know. Looking for discounts? Visit our Special Offers page!
CodeDelphiRAD Studio

Create Flexible Cross-Platform Apps With Multiple Tabs For iOS And Android In Delphi

The TabSliding sample shows in a good way how to create applications with multiple tabs for iOS and Android. The sample uses TabControl with TabPosition set to Dots in order to enable scrolling of tab items. The sample has 2 tab items, each one containing a different image.

Location

You can find the TabSliding sample project at:

  • Start | Programs | Embarcadero RAD Studio Sydney | Samples and then navigate to:
    • Object PascalMobile SnippetsTabSliding
    • CPPMobile SnippetsTabSliding
  • Subversion Repository:
    • You can find Delphi and C++ code samples in GitHub Repositories. Search by name into the samples repositories according to your RAD Studio version.

How to Use the Sample

  1. Navigate to one of the locations given above and open:
    • Delphi: TabSliding.dproj.
    • C++: TabSliding.cbproj.
  2. Select the target platform, iOS and Android supported.
  3. Press F9 or choose Run > Run.
  4. The sample shows an image. Slide the image in order to change between tabs. Each tab contains a different image.

Files

File in DelphiFile in C++Contains
TabSliding.dprojTabSliding.cbprojThe project itself.
uMain.fmxuMain.fmxThe main form where the components are located.
uMain.pasTabSlidingPCH.hTabSliding.cppUsed to define and implement the sample.
Information.txtInformation.txtFurther information about the sample.

Classes

TTabSlidingForm is the main form that represents the main window of the sample. It contains the following components:

Implementation

  • The sample uses TImage to display and define 2D image components.
  • The sample uses TGestureManager class to manage all the touch and gesturing functionalities of the application.
  • The sample uses TChangeTabAction to implement tab change actions.

When you run the application, the sample shows the first TTabItem. The sample has 2 tab items, each one containing its own image. The first TTabItem displays its image. When the user slides the image, a TChangeTabAction is invoked to change to the other TTabItem, which displays its image.

In the link below you can find detailed information about the sample, as well as links to other samples:

http://docwiki.embarcadero.com/CodeExamples/Sydney/en/FMX.TabSliding_Sample

Head over and check out the full source code for the TabSliding sample application on GitHub.

Do you want to build cross-platform apps with multiple tabs for iOS and Android? Try the Cross-Platform Development tool, which will assist you in developing apps in the Delphi or C++ environments.

See What's New in 12.2 Athens See What's New in 12.2 Athens Dev Days of Summer 2-24

Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial   Upgrade Today

   Free Delphi Community Edition   Free C++Builder Community Edition

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

IN THE ARTICLES