Skip to content

Commit 5283668

Browse files
Apply suggestions from code review
Co-authored-by: Dmitry Eliseev <81766219+dmitry-eliseev-devexpress@users.noreply.github.com>
1 parent bffee08 commit 5283668

2 files changed

Lines changed: 19 additions & 19 deletions

File tree

Delphi/uMainForm.pas

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ procedure TMainForm.SaveReportNameAndLayout();
7575
DataModule1.mdLayoutsName.AsString := dxReport1.ReportName;
7676
// Save the report layout
7777
DataModule1.mdLayoutsLayout.Assign(dxReport1.Layout);
78-
// Finish editing and write a modified record
78+
// Finish editing and post the modified record to the database
7979
DataModule1.mdLayouts.Post;
8080
end;
8181

README.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ The application allows users to create and save report layouts, modify existing
3030

3131
## Implementation Details
3232

33-
Follow the instructions in this example to store report layouts in a database of your choice,
33+
Follow the instructions listed in this example to store report layouts in a desired database
3434
using the corresponding `TDataSet` descendant.
3535

3636
The example uses a memory-based dataset
@@ -52,32 +52,32 @@ Follow these steps to create a memory-based dataset to store report layout data:
5252

5353
> <img src="./images/create-bind-data-source.png" style="width: 50%" alt=""/>
5454
55-
3. Open the context menu of the dataset component and select **Field Editor…**:
55+
3. Open the context menu for the dataset component and select **Field Editor…**:
5656

5757
> <img src="./images/open-context-menu.png" style="width: 50%" alt=""/>
5858
5959
4. Click **Add…** to create a BLOB field for layout data:
6060

6161
> <img src="./images/create-layout-field.png" style="width: 50%" alt=""/>
6262
63-
5. Click **Add…** to create a string field for layout name:
63+
5. Click **Add…** to create a string field for layout names:
6464

6565
> <img src="./images/create-name-field.png" style="width: 50%" alt=""/>
6666
6767
6. (*Optional*) Preload persistent data to the dataset make layouts available in the application upon first launch.
68-
Open the context menu of the dataset component, select **Persistent Editor…**, click **Load…** and select a DAT file.
68+
Open the context menu for the dataset component, select **Persistent Editor…**, click **Load…** and select the DAT file.
6969

7070
> <img src="./images/create-persistent-data.png" style="width: 50%" alt=""/>
7171
72-
This example has an example report layout designed to use data from the Northwind sample database.
72+
This example includes an sample report layout designed to use data from the Northwind sample database.
7373
You can preload it from [example.dat].
7474

75-
Alternatively, you can use the Report Designer in further steps to import report data from files or raw string data.
75+
Alternatively, you can use the Report Designer later to import report data from a file.
7676

7777

78-
### Step 2: Supply Layout Data to TdxReport
78+
### Step 2: Load a Report Layout Definition
7979

80-
Supply the [TdxReport] component with two values:
80+
To load a layout definition to the [TdxReport] component, you must specify
8181
report name ([TdxReport.ReportName]) and layout ([TdxReport.Layout]):
8282

8383
```pas
@@ -96,7 +96,7 @@ end;
9696
```
9797

9898
To load a different report, assign a new report name and layout.
99-
No cleanup is required between reports.
99+
The assigned report replaces the current layout definition.
100100

101101
<!--
102102
1. Assign report name and layout when application starts.
@@ -128,7 +128,7 @@ end;
128128

129129
When a user edits and saves a report in the Report Designer,
130130
the value of [TdxReport.Layout] changes and an [OnLayoutChanged] event is called.
131-
Handle this event to store the updated layout in the active dataset record.
131+
Handle this event to automatically store the updated layout in the active dataset record.
132132

133133
```pas
134134
procedure TMainForm.dxReport1LayoutChanged(ASender: TdxReport);
@@ -139,18 +139,18 @@ begin
139139
DataModule1.mdLayoutsName.AsString := dxReport1.ReportName;
140140
// Save the report layout
141141
DataModule1.mdLayoutsLayout.Assign(dxReport1.Layout);
142-
// Finish editing and write a modified record
142+
// Finish editing and post the modified record to the database
143143
DataModule1.mdLayouts.Post;
144144
end;
145145
```
146146

147-
### Step 6: Persist the Database State Between Application Sessions
147+
### Step 6: Store the Database State Between Application Sessions
148148

149-
This step is specific to the memory-based [TdxMemData] datasource.
149+
This step is applicable only to the memory-based [TdxMemData] datasource.
150150

151-
To persist the database state when user closes the application
152-
and restore the state when user restarts the application,
153-
handle the `Create` and `Destroy` events of the data module:
151+
To store the database state when user closes the application
152+
and restore the state on app restart,
153+
handle `OnCreate` and `OnDestroy` events of the data module:
154154

155155
```pas
156156
const
@@ -172,9 +172,9 @@ end;
172172

173173
## Files to Review
174174

175-
- [uData.pas] (Delphi) and [uData.cpp] (C++Builder) read and store layout data in a database represented by an in-memory storage component.
175+
- [uData.pas] (Delphi) and [uData.cpp] (C++Builder) store/restore layout data to/from a memory-based dataset component ([TdxMemData]).
176176
- [uMainForm.pas] (Delphi) and [uMainForm.cpp] (C++Builder) supply layout data from the data module to [TdxReport] and display Report Designer and Viewer.
177-
- [data.dat] persists the memory-based dataset between application sessions.
177+
- [data.dat] stores the memory-based dataset state between application sessions.
178178
- [nwind.db] contains the Northwind sample database used as a data source for report content.
179179

180180

0 commit comments

Comments
 (0)