Skip to content

Commit a79ff5a

Browse files
Fixed DbGrid for Rendering selected cell with Windows 11
Fixex colum draw in High-DPI app
1 parent 704de9d commit a79ff5a

File tree

5 files changed

+144
-279
lines changed

5 files changed

+144
-279
lines changed

Demo/DBAwareLabeledComponentsDemo.dproj

Lines changed: 11 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -124,17 +124,17 @@
124124
<DCCReference Include="..\Source\Vcl.DbAwareLabeledUtils.pas"/>
125125
<DCCReference Include="..\Source\Vcl.DbAwareLabeledConsts.pas"/>
126126
<DCCReference Include="..\Source\Vcl.BoundLabel.pas"/>
127+
<BuildConfiguration Include="Release">
128+
<Key>Cfg_2</Key>
129+
<CfgParent>Base</CfgParent>
130+
</BuildConfiguration>
127131
<BuildConfiguration Include="Base">
128132
<Key>Base</Key>
129133
</BuildConfiguration>
130134
<BuildConfiguration Include="Debug">
131135
<Key>Cfg_1</Key>
132136
<CfgParent>Base</CfgParent>
133137
</BuildConfiguration>
134-
<BuildConfiguration Include="Release">
135-
<Key>Cfg_2</Key>
136-
<CfgParent>Base</CfgParent>
137-
</BuildConfiguration>
138138
</ItemGroup>
139139
<ProjectExtensions>
140140
<Borland.Personality>Delphi.Personality.12</Borland.Personality>
@@ -478,11 +478,6 @@
478478
<Operation>1</Operation>
479479
<Extensions>.framework</Extensions>
480480
</Platform>
481-
<Platform Name="OSXARM64">
482-
<RemoteDir>Contents\MacOS</RemoteDir>
483-
<Operation>1</Operation>
484-
<Extensions>.framework</Extensions>
485-
</Platform>
486481
<Platform Name="Win32">
487482
<Operation>0</Operation>
488483
</Platform>
@@ -510,11 +505,6 @@
510505
<Operation>1</Operation>
511506
<Extensions>.dylib</Extensions>
512507
</Platform>
513-
<Platform Name="OSXARM64">
514-
<RemoteDir>Contents\MacOS</RemoteDir>
515-
<Operation>1</Operation>
516-
<Extensions>.dylib</Extensions>
517-
</Platform>
518508
<Platform Name="Win32">
519509
<Operation>0</Operation>
520510
<Extensions>.dll;.bpl</Extensions>
@@ -543,11 +533,6 @@
543533
<Operation>1</Operation>
544534
<Extensions>.dylib</Extensions>
545535
</Platform>
546-
<Platform Name="OSXARM64">
547-
<RemoteDir>Contents\MacOS</RemoteDir>
548-
<Operation>1</Operation>
549-
<Extensions>.dylib</Extensions>
550-
</Platform>
551536
<Platform Name="Win32">
552537
<Operation>0</Operation>
553538
<Extensions>.bpl</Extensions>
@@ -577,10 +562,6 @@
577562
<RemoteDir>Contents\Resources\StartUp\</RemoteDir>
578563
<Operation>0</Operation>
579564
</Platform>
580-
<Platform Name="OSXARM64">
581-
<RemoteDir>Contents\Resources\StartUp\</RemoteDir>
582-
<Operation>0</Operation>
583-
</Platform>
584565
<Platform Name="Win32">
585566
<Operation>0</Operation>
586567
</Platform>
@@ -1118,10 +1099,6 @@
11181099
<RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir>
11191100
<Operation>1</Operation>
11201101
</Platform>
1121-
<Platform Name="OSXARM64">
1122-
<RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir>
1123-
<Operation>1</Operation>
1124-
</Platform>
11251102
</DeployClass>
11261103
<DeployClass Name="ProjectOSXEntitlements">
11271104
<Platform Name="OSX32">
@@ -1132,10 +1109,6 @@
11321109
<RemoteDir>..\</RemoteDir>
11331110
<Operation>1</Operation>
11341111
</Platform>
1135-
<Platform Name="OSXARM64">
1136-
<RemoteDir>..\</RemoteDir>
1137-
<Operation>1</Operation>
1138-
</Platform>
11391112
</DeployClass>
11401113
<DeployClass Name="ProjectOSXInfoPList">
11411114
<Platform Name="OSX32">
@@ -1146,10 +1119,6 @@
11461119
<RemoteDir>Contents</RemoteDir>
11471120
<Operation>1</Operation>
11481121
</Platform>
1149-
<Platform Name="OSXARM64">
1150-
<RemoteDir>Contents</RemoteDir>
1151-
<Operation>1</Operation>
1152-
</Platform>
11531122
</DeployClass>
11541123
<DeployClass Name="ProjectOSXResource">
11551124
<Platform Name="OSX32">
@@ -1160,10 +1129,6 @@
11601129
<RemoteDir>Contents\Resources</RemoteDir>
11611130
<Operation>1</Operation>
11621131
</Platform>
1163-
<Platform Name="OSXARM64">
1164-
<RemoteDir>Contents\Resources</RemoteDir>
1165-
<Operation>1</Operation>
1166-
</Platform>
11671132
</DeployClass>
11681133
<DeployClass Required="true" Name="ProjectOutput">
11691134
<Platform Name="Android">
@@ -1194,10 +1159,6 @@
11941159
<RemoteDir>Contents\MacOS</RemoteDir>
11951160
<Operation>1</Operation>
11961161
</Platform>
1197-
<Platform Name="OSXARM64">
1198-
<RemoteDir>Contents\MacOS</RemoteDir>
1199-
<Operation>1</Operation>
1200-
</Platform>
12011162
<Platform Name="Win32">
12021163
<Operation>0</Operation>
12031164
</Platform>
@@ -1236,17 +1197,17 @@
12361197
<Operation>1</Operation>
12371198
</Platform>
12381199
</DeployClass>
1239-
<ProjectRoot Platform="OSX32" Name="$(PROJECTNAME).app"/>
1240-
<ProjectRoot Platform="OSX64" Name="$(PROJECTNAME).app"/>
1241-
<ProjectRoot Platform="Win32" Name="$(PROJECTNAME)"/>
1242-
<ProjectRoot Platform="Android64" Name="$(PROJECTNAME)"/>
1243-
<ProjectRoot Platform="Android" Name="$(PROJECTNAME)"/>
12441200
<ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
1245-
<ProjectRoot Platform="OSXARM64" Name="$(PROJECTNAME).app"/>
1246-
<ProjectRoot Platform="iOSDevice32" Name="$(PROJECTNAME).app"/>
12471201
<ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"/>
1202+
<ProjectRoot Platform="iOSDevice32" Name="$(PROJECTNAME).app"/>
1203+
<ProjectRoot Platform="OSXARM64" Name="$(PROJECTNAME).app"/>
1204+
<ProjectRoot Platform="Win32" Name="$(PROJECTNAME)"/>
12481205
<ProjectRoot Platform="Linux64" Name="$(PROJECTNAME)"/>
1206+
<ProjectRoot Platform="OSX32" Name="$(PROJECTNAME).app"/>
1207+
<ProjectRoot Platform="OSX64" Name="$(PROJECTNAME).app"/>
1208+
<ProjectRoot Platform="Android" Name="$(PROJECTNAME)"/>
12491209
<ProjectRoot Platform="iOSSimulator" Name="$(PROJECTNAME).app"/>
1210+
<ProjectRoot Platform="Android64" Name="$(PROJECTNAME)"/>
12501211
</Deployment>
12511212
<Platforms>
12521213
<Platform value="Win32">True</Platform>

Demo/Main.dfm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ object MainForm: TMainForm
1010
Font.Height = -11
1111
Font.Name = 'Tahoma'
1212
Font.Style = []
13+
OldCreateOrder = True
1314
ShowHint = True
1415
OnCreate = FormCreate
1516
PixelsPerInch = 96
@@ -87,6 +88,7 @@ object MainForm: TMainForm
8788
Font.Style = []
8889
ScrollBars = ssVertical
8990
TabOrder = 3
91+
Zoom = 100
9092
BoundCaption = 'LabeledDBRichEdit:'
9193
BoundLabel.Left = 332
9294
BoundLabel.Top = 10
@@ -206,6 +208,7 @@ object MainForm: TMainForm
206208
Alignment = taCenter
207209
Expanded = False
208210
FieldName = 'BooleanField'
211+
Width = 80
209212
Visible = True
210213
end
211214
item
@@ -389,6 +392,7 @@ object MainForm: TMainForm
389392
ParentFont = False
390393
ScrollBars = ssVertical
391394
TabOrder = 7
395+
Zoom = 100
392396
BoundCaption = 'LabeledRichEdit:'
393397
BoundLabel.Left = 340
394398
BoundLabel.Top = 102

Demo/Main.pas

Lines changed: 35 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ TMainForm = class(TForm)
130130
procedure VisibleCheckBoxClick(Sender: TObject);
131131
private
132132
FMemoText: string;
133+
procedure CreateControls;
133134
procedure CreateAndFillDataSets;
134135
{$IFDEF D10_4+}
135136
procedure CreateNumberBoxForField(const AField: TField;
@@ -140,7 +141,10 @@ TMainForm = class(TForm)
140141
procedure FillEditors;
141142
procedure SetControlsLabelPosition(ARootControl: TWinControl;
142143
APosition: TControlLabelPosition; AVisible: Boolean);
144+
protected
145+
procedure Loaded; override;
143146
public
147+
constructor Create(AOwner: TComponent); override;
144148
end;
145149

146150
var
@@ -232,6 +236,17 @@ procedure TMainForm.CreateDBCurrencyEdit(const AField: TField; const ATop, ALeft
232236
LDBCurrencyEdit.parent := NumberBoxTabSheet;
233237
end;
234238

239+
procedure TMainForm.Loaded;
240+
begin
241+
CreateControls;
242+
inherited;
243+
end;
244+
245+
constructor TMainForm.Create(AOwner: TComponent);
246+
begin
247+
inherited;
248+
end;
249+
235250
procedure TMainForm.FormCreate(Sender: TObject);
236251
begin
237252
Caption := Application.Title;
@@ -269,8 +284,8 @@ procedure TMainForm.CreateNumberBoxForField(const AField: TField;
269284
begin
270285
LDBNumberBox := TLabeledDBNumberBox.Create(Self);
271286
LDBNumberBox.BoundCaption := AField.DisplayLabel;
272-
LDBNumberBox.BoundLabel.SetPosition(lpLeftMiddle);
273287
LDBNumberBox.SetBounds(ALeft,ATop,131,21);
288+
LDBNumberBox.BoundLabel.SetPosition(lpLeftMiddle);
274289
LDBNumberBox.Hint := 'Hint';
275290
LDBNumberBox.Alignment := taRightJustify;
276291
// LDBNumberBox.CurrencyFormat := 2;
@@ -285,6 +300,25 @@ procedure TMainForm.CreateNumberBoxForField(const AField: TField;
285300
end;
286301
{$ENDIF}
287302

303+
procedure TMainForm.CreateControls;
304+
begin
305+
CreateDBCurrencyEdit(ClientDataSetIntegerField, 20,110);
306+
CreateDBCurrencyEdit(ClientDataSetFloatField, 60,110);
307+
CreateDBCurrencyEdit(ClientDataSetCurrencyField, 100,110);
308+
CreateDBCurrencyEdit(ClientDataSetBCDField, 140,110);
309+
CreateDBCurrencyEdit(ClientDataSetExtendedField, 180,110);
310+
CreateDBCurrencyEdit(ClientDataSetFmtBCDField, 220,110);
311+
312+
{$IFDEF D10_4+}
313+
CreateNumberBoxForField(ClientDataSetIntegerField, 20,360);
314+
CreateNumberBoxForField(ClientDataSetFloatField, 60,360);
315+
CreateNumberBoxForField(ClientDataSetCurrencyField, 100,360);
316+
CreateNumberBoxForField(ClientDataSetBCDField, 140,360);
317+
CreateNumberBoxForField(ClientDataSetExtendedField, 180,360);
318+
CreateNumberBoxForField(ClientDataSetFmtBCDField, 220,360);
319+
{$ENDIF}
320+
end;
321+
288322
procedure TMainForm.CreateAndFillDataSets;
289323
var
290324
LRoundValue1, LRoundValue2, LRoundValue3, LRoundValue4, LRoundValue5, LRoundValue6: Double;
@@ -306,22 +340,6 @@ procedure TMainForm.CreateAndFillDataSets;
306340
ClientDataSetCurrencyField.DisplayFormat := '€ #,###.00';
307341
ClientDataSetBCDField.DisplayFormat := '€ #,###.00';
308342

309-
CreateDBCurrencyEdit(ClientDataSetIntegerField, 20,110);
310-
CreateDBCurrencyEdit(ClientDataSetFloatField, 60,110);
311-
CreateDBCurrencyEdit(ClientDataSetCurrencyField, 100,110);
312-
CreateDBCurrencyEdit(ClientDataSetBCDField, 140,110);
313-
CreateDBCurrencyEdit(ClientDataSetExtendedField, 180,110);
314-
CreateDBCurrencyEdit(ClientDataSetFmtBCDField, 220,110);
315-
316-
{$IFDEF D10_4+}
317-
CreateNumberBoxForField(ClientDataSetIntegerField, 20,360);
318-
CreateNumberBoxForField(ClientDataSetFloatField, 60,360);
319-
CreateNumberBoxForField(ClientDataSetCurrencyField, 100,360);
320-
CreateNumberBoxForField(ClientDataSetBCDField, 140,360);
321-
CreateNumberBoxForField(ClientDataSetExtendedField, 180,360);
322-
CreateNumberBoxForField(ClientDataSetFmtBCDField, 220,360);
323-
{$ENDIF}
324-
325343
//Fill ClientDataSet
326344
LStream := nil;
327345
LMemoryStreamEthea := nil;

0 commit comments

Comments
 (0)