C++ Builder 10.4, FMX: Form TabOrder problem

268 views Asked by At

The Tab functionality to switch between control fields seems to be not working with C++ Builder 10.4 (with patch 1, 2 and 3), if a form control which contains some taborder fields, gets another parent form control programmaticly.

This can be reproduced very easily by creating a Multi-Device Application, with just 2 TLayout-controls and 2 TEdit-controls on a form:

Steps to reproduce:

  • Create a new Multi-Device Application, Blank Application. This will create a Unit1 with a blank form.
  • For the generated Unit1, just drop a TLayout from the Palette to the form and resize this to match almost the left half of the form.
  • Drop a second TLayout control on the form (Layout2) and resize this layout to match the right half of the form.
  • Drop 2 TEdit control fields on Layout1 (Edit1 and Edit2).
  • For Layout1, set the TabOrder property to 0, and make sure the property TabStop is set to True.
  • For Layout2, set the TabOrder property to 1, and make sure the property TabStop is set to True.
  • For Edit1, set the TabOrder property to 0, make sure the property TabStop is set to True, and set text to "edit1".
  • For Edit2, set the TabOrder property to 1, make sure the property TabStop is set to True, and set text to "edit2".
  • Build and run the project: The form with 2 edit fields appears and with Tab you can switch between the fields. This is OK! If the value of the Layout1 property TabOrder is kept to be -1, the Tab is also working, but only after selecting 1 of the edit fields with a mouse-click.
  • Now, in the constructor of TForm1 program Layout2 as the parent of Layout1:
    #include "Unit1.h"
    //---------------------------------------------------------------------------
    #pragma package(smart_init)
    #pragma resource "*.fmx"
    TForm1 *Form1;
    //---------------------------------------------------------------------------
    __fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
    {
        Layout1->Parent = Layout2;
    }
  • Build and run the project again. The position of the edit fields on the form is now changed to the right as expected. But there the Tab functionality is gone!

Why? If the same steps are executed in C++ Builder 10.2, the Tab functionality keeps working after setting the parent of Layout1 to Layout2.

Content of Unit1.fmx, as requested by "Schneider Infosystems Ltd":

    object Form1: TForm1
      Left = 0
      Top = 0
      Caption = 'Form1'
      ClientHeight = 480
      ClientWidth = 640
      FormFactor.Width = 320
      FormFactor.Height = 480
      FormFactor.Devices = [Desktop]
      OnShow = FormShow
      DesignerMasterStyle = 0
      object Layout1: TLayout
        Position.X = 8.000000000000000000
        Position.Y = 8.000000000000000000
        Size.Width = 305.000000000000000000
        Size.Height = 409.000000000000000000
        Size.PlatformDefault = False
        TabOrder = 0
        object Edit1: TEdit
          Touch.InteractiveGestures = [LongTap, DoubleTap]
          TabOrder = 0
          Text = 'edit1'
          Position.X = 64.000000000000000000
          Position.Y = 72.000000000000000000
        end
        object Edit2: TEdit
          Touch.InteractiveGestures = [LongTap, DoubleTap]
          TabOrder = 1
          Text = 'edit2'
          Position.X = 64.000000000000000000
          Position.Y = 112.000000000000000000
        end
      end
      object Layout2: TLayout
        Position.X = 328.000000000000000000
        Position.Y = 8.000000000000000000
        Size.Width = 305.000000000000000000
        Size.Height = 409.000000000000000000
        Size.PlatformDefault = False
        TabOrder = 1
      end
    end
1

There are 1 answers

0
Eelco On BEST ANSWER

Yes! It works after installing "C++ Builder 10.4.1" ! So, it was a bug in 10.4.

I have to do a lot more actions to build and test all existing software I care about, but I am happy that the TAB-key functionallity seems to be solved! :)

I had to do a complete deïnstall and install of RadStudio. Also third party software has to be integrated again in the IDE. A lot of work. I keep wondering why this was necessary, and could not be solved with patch updates with "GetIt" in version 10.4.