Skip to content

Commit 10050e6

Browse files
cpp-builder: Focus the example on DevExpress Reports localization
- Add an empty example report to ensure both dialogs can load. - Switch languages using TcxRadioButtons. TcxRadioButtons better represent application state than simple buttons. - Use the German localization language when application starts. Check the "German" radiobutton to reflect the default localization. - Group "Display Report" buttons into a labeled group, change captions. Move focus to "Display Report Designer" button when application starts. - Forbid to resize the application form. - Give the application a relevant title. - Use a DevExpress application icon. - Remove the Data Grid table. In this example, data structure is not in the focus of demonstration. Data Grid table draws attention from the localization examples. - Rename several interface components and code members according to DevExpress style. - Comment significant actions in the code example. Signed-off-by: Nick Volynkin <nikolay.volynkin@devexpress.com> Co-authored-by: Vladimir Abadzhev <vladimira@devexpress.com>
1 parent 916c628 commit 10050e6

3 files changed

Lines changed: 929 additions & 196 deletions

File tree

CPB/uMainForm.cpp

Lines changed: 24 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,64 @@
1-
//---------------------------------------------------------------------------
2-
31
#include <vcl.h>
42
#pragma hdrstop
53

64
#include "uMainForm.h"
7-
//---------------------------------------------------------------------------
5+
86
#pragma package(smart_init)
97
#pragma link "cxButtons"
108
#pragma link "cxClasses"
119
#pragma link "cxControls"
12-
#pragma link "cxCustomData"
13-
#pragma link "cxData"
14-
#pragma link "cxDataStorage"
15-
#pragma link "cxDBData"
16-
#pragma link "cxEdit"
17-
#pragma link "cxFilter"
1810
#pragma link "cxGraphics"
19-
#pragma link "cxGrid"
20-
#pragma link "cxGridCustomTableView"
21-
#pragma link "cxGridCustomView"
22-
#pragma link "cxGridDBTableView"
23-
#pragma link "cxGridLevel"
24-
#pragma link "cxGridTableView"
2511
#pragma link "cxLookAndFeelPainters"
2612
#pragma link "cxLookAndFeels"
27-
#pragma link "cxNavigator"
28-
#pragma link "cxStyles"
29-
#pragma link "dxDateRanges"
3013
#pragma link "dxReport"
31-
32-
33-
#pragma link "dxScrollbarAnnotations"
3414
#pragma link "dxmdaset"
3515
#pragma link "cxContainer"
36-
#pragma link "cxLabel"
16+
#pragma link "cxRadioGroup"
17+
#pragma link "cxGroupBox"
3718
#pragma link "dxBackend"
3819
#pragma link "dxBackend.ConnectionString.JSON"
3920
#pragma link "dxBackend.ConnectionString.JSON.DataSet"
4021
#pragma resource "*.dfm"
4122
TMainForm *MainForm;
42-
//---------------------------------------------------------------------------
23+
4324
__fastcall TMainForm::TMainForm(TComponent* Owner)
4425
: TForm(Owner)
4526
{
27+
}
4628

29+
void __fastcall TMainForm::FormCreate(TObject *Sender)
30+
{
31+
// Path to a saved example report file
32+
const String AFileName = "ExampleReport.repx";
33+
34+
// Load example report from a file
35+
if (FileExists(AFileName))
36+
{
37+
dxReport1->ReportName = "ExampleReport";
38+
dxReport1->Layout->LoadFromFile(AFileName);
39+
}
4740
}
48-
//---------------------------------------------------------------------------
4941

50-
//---------------------------------------------------------------------------
51-
void __fastcall TMainForm::btnShowDesignerClick(TObject *Sender)
42+
void __fastcall TMainForm::btnDisplayDesignerClick(TObject *Sender)
5243
{
44+
// Display the DevExpress Report Designer dialog
5345
dxReport1->ShowDesigner();
5446
}
55-
//---------------------------------------------------------------------------
5647

57-
void __fastcall TMainForm::btnViewReportClick(TObject *Sender)
48+
void __fastcall TMainForm::btnDisplayReportClick(TObject *Sender)
5849
{
50+
// Display the DevExpress Report Viewer dialog
5951
dxReport1->ShowViewer();
6052
}
61-
//---------------------------------------------------------------------------
62-
6353

64-
65-
void __fastcall TMainForm::btnSetLanguageUSClick(TObject *Sender)
54+
void __fastcall TMainForm::rbtnSelectEnglishLocalizationClick(TObject *Sender)
6655
{
56+
// Switch Report UI to English
6757
dxReport1->Language = "en-US";
6858
}
69-
//---------------------------------------------------------------------------
7059

71-
void __fastcall TMainForm::btnSetLanguageDEClick(TObject *Sender)
60+
void __fastcall TMainForm::rbtnSelectGermanLocalizationClick(TObject *Sender)
7261
{
62+
// Switch Report UI to German
7363
dxReport1->Language = "de-DE";
7464
}
75-
//---------------------------------------------------------------------------
76-

0 commit comments

Comments
 (0)