Normal assignments

Top  Previous  Next

DFM-Translator > Normal assignments

By default, when DFM translation is enabled in the processor options, all lines of DFM code are converted to C++ assignment statements. As an example of such a conversion, the original code and the resulting code in the constructor of a TForm are compared line by line:below:

 

 

  DFM code                              C++ code                                                   

  -----------------------------------------------------------------------------                    

  Object AboutBox: TAboutBox                                                                       

    Left = 229                          Left = 229;                                                

    Top = 166                           Top = 166;                                                 

    BorderStyle = bsDialog              BorderStyle = TFormBorderStyle::bsDialog;                  

    Caption = 'About RichEdit'          Caption = L"About RichEdit";                               

    ...                                 ...                                                        

                                                                                                                                                                         

    Object OKButton: TButton            OKButton = new TButton(this);                                   

      Left = 269                        OKButton->Left = 269;                                      

      Top = 208                         OKButton->Top = 208;                                       

      Width = 75                        OKButton->Width = 75;                                      

      Height = 25                       OKButton->Height = 25;                                     

      Cancel = True                     OKButton->Cancel = true;                                   

      Caption = 'OK'                    OKButton->Caption = L"OK";                                 

      Default = True                    OKButton->Default = true;                                  

      ModalResult = 2                   OKButton->ModalResult = 2;                                 

      TabOrder = 0                      OKButton->TabOrder = 0;                                    

    end                                 OKButton->Parent = this;                                                           

  end                                                                                              

 

 

Only the creation of the button goes beyond a simple assignment: in C++ the OKButton is explicitely created at runtime and the form is set as its parent.

 

 



This page belongs to the Delphi2Cpp Documentation

Delphi2Cpp home  Content