Skip to content

Commit f490eb8

Browse files
ver.1.3.6
- Fixed Formatting value of TLabeledDBCurrencyEdit - Fixed Demo using static MidasLib
1 parent 33a05b3 commit f490eb8

9 files changed

+69
-35
lines changed

Demo/DBAwareLabeledComponentsDemo.dpr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
program DBAwareLabeledComponentsDemo;
22

33
uses
4+
MidasLib,
45
Vcl.Forms,
56
Main in 'Main.pas' {MainForm},
67
Vcl.LabeledShellUtils in '..\Source\Vcl.LabeledShellUtils.pas',

Demo/DBAwareLabeledComponentsDemo.dproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<TargetedPlatforms>3</TargetedPlatforms>
1010
<AppType>Application</AppType>
1111
<MainSource>DBAwareLabeledComponentsDemo.dpr</MainSource>
12+
<ProjectName Condition="'$(ProjectName)'==''">DBAwareLabeledComponentsDemo</ProjectName>
1213
</PropertyGroup>
1314
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
1415
<Base>true</Base>
@@ -109,7 +110,6 @@
109110
</DelphiCompile>
110111
<DCCReference Include="Main.pas">
111112
<Form>MainForm</Form>
112-
<FormType>dfm</FormType>
113113
</DCCReference>
114114
<DCCReference Include="..\Source\Vcl.LabeledShellUtils.pas"/>
115115
<DCCReference Include="..\Source\Vcl.LabeledMask.pas"/>

Demo/Main.dfm

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ object MainForm: TMainForm
2323
ActivePage = DbGridTabSheet
2424
Align = alClient
2525
TabOrder = 0
26+
OnChange = PageControlChange
2627
object DbGridTabSheet: TTabSheet
2728
Caption = 'Labeled and Advanced DbGrid'
2829
ImageIndex = 2
@@ -333,7 +334,7 @@ object MainForm: TMainForm
333334
Top = 153
334335
Width = 162
335336
Height = 23
336-
EditLabel.Width = 114
337+
EditLabel.Width = 113
337338
EditLabel.Height = 15
338339
EditLabel.Caption = 'Filter data expression:'
339340
TabOrder = 5
@@ -384,7 +385,7 @@ object MainForm: TMainForm
384385
BoundCaption = 'LabeledDBComboBox:'
385386
BoundLabel.Left = 88
386387
BoundLabel.Top = 50
387-
BoundLabel.Width = 119
388+
BoundLabel.Width = 118
388389
BoundLabel.Height = 15
389390
end
390391
object LabeledDBMemo: TLabeledDBMemo
@@ -438,7 +439,7 @@ object MainForm: TMainForm
438439
BoundCaption = 'LabeledDBListBox:'
439440
BoundLabel.Left = 333
440441
BoundLabel.Top = 112
441-
BoundLabel.Width = 97
442+
BoundLabel.Width = 96
442443
BoundLabel.Height = 15
443444
end
444445
object LabeledDBEditEx: TLabeledDBEdit
@@ -470,7 +471,7 @@ object MainForm: TMainForm
470471
BoundCaption = 'LabeledDBLookupComboBox:'
471472
BoundLabel.Left = 88
472473
BoundLabel.Top = 96
473-
BoundLabel.Width = 159
474+
BoundLabel.Width = 158
474475
BoundLabel.Height = 15
475476
end
476477
object LabeledDBLookupListBox: TLabeledDBLookupListBox
@@ -487,7 +488,7 @@ object MainForm: TMainForm
487488
BoundCaption = 'LabeledDBLookupListBox:'
488489
BoundLabel.Left = 333
489490
BoundLabel.Top = 192
490-
BoundLabel.Width = 137
491+
BoundLabel.Width = 136
491492
BoundLabel.Height = 15
492493
end
493494
object LabeledDBImage: TLabeledDBImage
@@ -523,7 +524,7 @@ object MainForm: TMainForm
523524
BoundCaption = 'LabeledEditEx:'
524525
BoundLabel.Left = 88
525526
BoundLabel.Top = 8
526-
BoundLabel.Width = 76
527+
BoundLabel.Width = 75
527528
BoundLabel.Height = 15
528529
end
529530
object LabeledCurrencyEdit: TLabeledCurrencyEdit
@@ -568,7 +569,7 @@ object MainForm: TMainForm
568569
BoundCaption = 'LabeledComboBox:'
569570
BoundLabel.Left = 88
570571
BoundLabel.Top = 88
571-
BoundLabel.Width = 104
572+
BoundLabel.Width = 103
572573
BoundLabel.Height = 15
573574
end
574575
object LabeledMaskEdit: TLabeledMaskEdit
@@ -637,7 +638,7 @@ object MainForm: TMainForm
637638
BoundCaption = 'LabeledCheckListBox:'
638639
BoundLabel.Left = 340
639640
BoundLabel.Top = 208
640-
BoundLabel.Width = 115
641+
BoundLabel.Width = 114
641642
BoundLabel.Height = 15
642643
end
643644
object LabeledListBox: TLabeledListBox
@@ -654,7 +655,7 @@ object MainForm: TMainForm
654655
BoundCaption = 'LabeledListBox:'
655656
BoundLabel.Left = 341
656657
BoundLabel.Top = 284
657-
BoundLabel.Width = 82
658+
BoundLabel.Width = 81
658659
BoundLabel.Height = 15
659660
TextDelimited = 'First;Second;Last'
660661
end
@@ -5356,7 +5357,7 @@ object MainForm: TMainForm
53565357
BoundCaption = 'LabeledColorBox:'
53575358
BoundLabel.Left = 360
53585359
BoundLabel.Top = 224
5359-
BoundLabel.Width = 93
5360+
BoundLabel.Width = 92
53605361
BoundLabel.Height = 15
53615362
end
53625363
end

Demo/Main.pas

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ TMainForm = class(TForm)
179179
procedure VisibleCheckBoxClick(Sender: TObject);
180180
procedure LabeledButtonEditClick(Sender: TObject);
181181
procedure cbWrapAllTextClick(Sender: TObject);
182+
procedure PageControlChange(Sender: TObject);
182183
private
183184
FMemoText: string;
184185
procedure BkCellColorAssign(Column : TColumn; DrawingCurrentRecord : boolean; var CellColor : TColor);
@@ -201,6 +202,7 @@ TMainForm = class(TForm)
201202
procedure FillEditors;
202203
procedure SetControlsLabelPosition(ARootControl: TWinControl;
203204
APosition: TControlLabelPosition; AVisible: Boolean);
205+
procedure AssignDataSourceToNavigator;
204206
protected
205207
procedure Loaded; override;
206208
public
@@ -255,6 +257,11 @@ procedure TMainForm.VisibleCheckBoxClick(Sender: TObject);
255257
PositionLabeledComboBoxSelect(PositionLabeledComboBox);
256258
end;
257259

260+
procedure TMainForm.PageControlChange(Sender: TObject);
261+
begin
262+
AssignDataSourceToNavigator;
263+
end;
264+
258265
procedure TMainForm.PositionLabeledComboBoxSelect(Sender: TObject);
259266
var
260267
LLabelPosition: TControlLabelPosition;
@@ -295,7 +302,9 @@ procedure TMainForm.CreateDBCurrencyEdit(const AField: TField; const ATop, ALeft
295302
LDBCurrencyEdit.TextHint := 'Text Hint';
296303
LDBCurrencyEdit.DataSource := DataSource;
297304
LDBCurrencyEdit.DataField := AField.FieldName;
305+
LDBCurrencyEdit.NumberValues := [nvNegative, nvPositive];
298306
LDBCurrencyEdit.parent := NumberBoxTabSheet;
307+
299308
end;
300309

301310
procedure TMainForm.Loaded;
@@ -552,6 +561,16 @@ procedure TMainForm.CreateAndFillDataSets;
552561
DataSource.DataSet := ClientDataSet;
553562
end;
554563

564+
procedure TMainForm.AssignDataSourceToNavigator;
565+
begin
566+
if PageControl.ActivePage = DbGridTabSheet then
567+
DBNavigator.DataSource := DbGrid.DataSource
568+
else if DataSource.DataSet.Active then
569+
DBNavigator.DataSource := DataSource
570+
else
571+
DBNavigator.DataSource := nil;
572+
end;
573+
555574
procedure TMainForm.BkCellColorAssign(Column: TColumn;
556575
DrawingCurrentRecord: boolean; var CellColor: TColor);
557576
begin
@@ -644,6 +663,7 @@ procedure TMainForm.FormShow(Sender: TObject);
644663
LineTrackBarChange(LineTrackBar);
645664
RowMarginTrackBar.Position := DbGrid.RowMargin;
646665
RowMarginTrackBarChange(RowMarginTrackBar);
666+
AssignDataSourceToNavigator;
647667
end;
648668

649669
procedure TMainForm.gridDrawColumnCell(Sender: TObject; const Rect: TRect;

README.htm

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
<h1>DBAwareLabeledComponents</h1>
3333
<p><a href="https://opensource.org/licenses/Apache-2.0"><img src="https://img.shields.io/badge/License-Apache%202.0-yellowgreen.svg" alt="License"/></a></p>
3434
<p>An extended TDBGrid plus classic Delphi-VCL Editors with Boundary-Label (DB-Aware and Standard) including NumberBox</p>
35-
<h3>Actual official version 1.3.5 (VCL)</h3>
35+
<h3>Actual official version 1.3.6 (VCL)</h3>
3636
<h2>New Setup for automatic installation of components</h2>
3737
<p>From 1.3.3 version a new &ldquo;Installer&rdquo; read-to-use is located in the Release area: <a href="https://github.com/EtheaDev/DBAwareLabeledComponents/releases/latest/download/DBAwareLabeledComponents_Setup.exe">Download the Installer</a>.</p>
3838
<p>The Installer automatically detect your Delphi versions, install sources, build and install packages and add source paths.</p>
@@ -113,6 +113,11 @@ <h3>Available from Delphi XE3 to Delphi 13 (32bit and 64bit platforms)</h3>
113113
<p><img src="./Images/SupportingDelphi.jpg" alt="Delphi Support"/></p>
114114
<p>Related links: https://www.embarcadero.com/ - https://learndelphi.org/</p>
115115
<h3>RELEASE NOTES</h3>
116+
<p>08 Oct 2025: ver.1.3.6</p>
117+
<ul>
118+
<li>Fixed Formatting value of TLabeledDBCurrencyEdit</li>
119+
<li>Fixed Demo using static MidasLib</li>
120+
</ul>
116121
<p>14 Sep 2025: ver.1.3.5</p>
117122
<ul>
118123
<li>Fixed Setup for Delphi 13</li>

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
An extended TDBGrid plus classic Delphi-VCL Editors with Boundary-Label (DB-Aware and Standard) including NumberBox
66

7-
### Actual official version 1.3.5 (VCL)
7+
### Actual official version 1.3.6 (VCL)
88

99
## New Setup for automatic installation of components
1010

@@ -79,6 +79,10 @@ A complete Demo is available in Demo Folder.
7979
Related links: https://www.embarcadero.com/ - https://learndelphi.org/
8080

8181
### RELEASE NOTES
82+
08 Oct 2025: ver.1.3.6
83+
- Fixed Formatting value of TLabeledDBCurrencyEdit
84+
- Fixed Demo using static MidasLib
85+
8286
14 Sep 2025: ver.1.3.5
8387
- Fixed Setup for Delphi 13
8488

Source/Vcl.DBAwareLabeledComponentsRegistry.pas

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ implementation
6161
;
6262

6363
const
64-
ComponentsVersion = '1.3.5';
64+
ComponentsVersion = '1.3.6';
6565
Component_Docs_URL = 'https://ethea.it/docs/dbawarelabeledcomponents/Overview.html';
6666
{$IFDEF D11+}
6767
ABOUT_RES_NAME = 'DBAWARESPLASH48PNG';

Source/Vcl.DBNumberBox.pas

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ TDbNumberBox = class(TCustomNumberBox)
5959
procedure SetReadOnly(const Value: boolean);
6060
procedure SetFocused(Value: Boolean);
6161
protected
62-
procedure DoChangeValue; override;
6362
property DataLink: TFieldDataLink read FDataLink;
6463
procedure RecordChanged(Sender : TFieldDataLink); virtual;
6564
procedure DataSetChanged(Sender : TFieldDataLink); virtual;
@@ -186,12 +185,6 @@ destructor TDbNumberBox.Destroy;
186185
inherited;
187186
end;
188187

189-
procedure TDbNumberBox.DoChangeValue;
190-
begin
191-
inherited;
192-
// FDataLink.Edit;
193-
end;
194-
195188
procedure TDbNumberBox.EditingChange(Sender: TObject);
196189
begin
197190
inherited ReadOnly := not FDataLink.Editing;
@@ -204,17 +197,22 @@ function TDbNumberBox.IsEmpty: boolean;
204197

205198
procedure TDbNumberBox.DataSetChanged(Sender: TFieldDataLink);
206199
begin
207-
;
200+
; //Dataset level changes
208201
end;
209202

210203
procedure TDbNumberBox.LinkEditingChanged(Sender: TFieldDataLink);
211204
begin
212-
;
205+
; //Dataset level changes
213206
end;
214207

215208
procedure TDbNumberBox.RecordChanged(Sender: TFieldDataLink);
216209
begin
217-
;
210+
; //Dataset level changes
211+
end;
212+
213+
procedure TDbNumberBox.ActiveChange(Sender: TObject);
214+
begin
215+
; //Dataset level changes
218216
end;
219217

220218
function TDbNumberBox.GetDataSource: TDataSource;
@@ -468,11 +466,6 @@ procedure TDbNumberBox.CMExit(var Message: TCMExit);
468466
inherited;
469467
end;
470468

471-
procedure TDbNumberBox.ActiveChange(Sender: TObject);
472-
begin
473-
;
474-
end;
475-
476469
initialization
477470

478471
finalization

Source/Vcl.LabeledCurrencyEdit.pas

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -362,23 +362,33 @@ procedure TLabeledDBCurrencyEdit.Reformat;
362362
Negative : Boolean;
363363
TempText : string;
364364
begin
365-
//modifica il testo del money-edit solo se la tabella è editabile
365+
//Modify Text of Component only if Table is Editable
366366
if (Field <> nil) and (Field.CanModify) then
367367
begin
368368
TempText := Text;
369369
Negative := (Pos('-',TempText)<>0) or not (nvPositive in FNumberValues);
370+
//Remove Minus char for the moment
370371
if Negative then
371372
TempText := KillChar(TempText,'-');
372-
if TempText = '' then TempText := '0';
373-
//Elimino eventuali separatori decimali
373+
//Inizialize Temp value to Zero
374+
if TempText = '' then
375+
TempText := '0';
376+
//Delete decimal separators
374377
TempText := KillChar(TempText,FormatSettings.ThousandSeparator);
375-
//Elimino eventuale simbolo monetario
378+
//Delete currency symbol
376379
TempText := KillSubString(FormatSettings.CurrencyString,TempText);
377-
//Elimino evetuali spazi
380+
//Delete spaces
378381
TempText := KillChar(TempText,' ');
382+
//Format Value
379383
if FFormatFloat <> '' then
380384
TempText := FormatFloat(FFormatFloat, StrToFloat(TempText));
381-
if Negative and (TempText[1]<>'-') then TempText := '-'+TempText;
385+
//Add minus in case of Negative value
386+
if Negative and (TempText[1]<>'-') then
387+
TempText := '-'+TempText;
388+
//Remove first zero for Number size > 1
389+
if (Copy(TempText,1,1)='0') and (length(TempText) > 1) then
390+
TempText := Copy(TempText,2,MaxLength);
391+
//Assign Text if different
382392
if (TempText <> Text) then
383393
Text := TempText;
384394
end;

0 commit comments

Comments
 (0)