Sign in Join
Wiki copytemporary

User Changes 2.2.4: what changed

Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11## About this page
22
33Below you can find a list of intentional changes between the [[User Changes 2.2.2|the 2.2.2 release]] and the 2.2.4 release which can change the behaviour of previously working code, along with why these changes were performed and how you can adapt your code if you are affected by them.
44
55## All systems
66
77### Default property values
88
99- **Old behaviour**: Published properties without a specified *default* were not streamed under certain circumstances.
1010- **New behaviour**: Such properties are now treated as if they had *nodefault* specified. This means that some extra properties will now be streamed in such cases:
1111 - Boolean fields with the value *false*
1212 - Enumerated types with the ordinal value *0*
1313- **Example**:
1414
1515``` pascal
1616type
1717 tenum = (ea,eb,ec);
1818 tc = class
1919 private
2020 fmybool: boolean;
2121 fenum: tenum;
2222 published
2323 property mybool: boolean read fmybool write fmybool;
2424 property enum: tenum read fenum write fenum;
2525 end;
2626
2727var
2828 c: tc;
2929begin
3030 c:=tc.create;
3131 // write c to a stream
3232end.
3333```
3434
3535In earlier versions, *mybool* nor *enum* would be written to the stream in this case, while now they will be.
3636
3737- **Reason**: Delphi compatibility.
3838- **Remedy**: Explicitly specify default values as follows
3939
4040``` pascal
4141type
4242 tenum = (ea,eb,ec);
4343 tc = class
4444 private
4545 fmybool: boolean;
4646 fenum: tenum;
4747 published
4848 property mybool: boolean read fmybool write fmybool default false;
4949 property enum: tenum read fenum write fenum default ea;
5050 end;
5151```
5252
5353### db unit: TField*.*Size type
5454
5555- **Old behaviour**: TFieldDef.Size, TField.Size and TField.DataSize were defined as word.
5656- **New behaviour**: TFieldDef.Size, TField.Size and TField.DataSize are defined as integers. This also means that definition of the corresponding methods has changed.
5757- **Example**: The following definitions of methods have been changed:
5858 - constructor TFieldDef.Create(AOwner: TFieldDefs; const AName: string; ADataType: TFieldType; ASize: **Integer**; ARequired: Boolean; AFieldNo: Longint)
5959 - procedure TFieldDef.SetSize(const AValue: **integer**);
6060 - function TField.GetDataSize: **integer**;
6161 - procedure TField.SetSize(AValue: **integer**);
6262- **Reason**: Delphi compatibility.
6363- **Remedy**: Change the definition of these properties in your methods that override one of the methods above from word to integer.
6464
6565### db unit: TField*.Lookup property is not published anymore
6666
6767- **Old behaviour**: TField.Lookup was published, so it was streamed if it was set to True (i.e. for a fkLookup field)
6868- **New behaviour**: TField.Lookup is not published anymore, so if you try to read back its streamed value (e.g., loading Lazarus forms) it will fail.
6969- **Reason**: The value of this property was also modified by setting FieldKind, which is also streamed. See [Bug 12809](http://bugs.freepascal.org/view.php?id=12809)
7070- **Remedy**: If you use Lazarus, remove references to *Lookup* properties in your project's lfm files.
7171
7272## All Unix-based systems
7373
7474### Executing external programs using TProcess
7575
7676- **Old behaviour**: When TProcess was used to execute a program and no explicit path to the executable was given, TProcess searched for the executable in the current directory, and only if it was not found there it looked in the system path.
7777- **New behaviour**: On all Unix-based systems, TProcess will not search for the executable in the current directory anymore, unless the current directory is in the system path.
7878- **Example**: When you use TProcess to execute 'ls' and there is an 'ls' executable in both the current directory and in '/bin/', then programs compiled with FPC 2.2.2 will execute './ls' (thus in the current directory). Programs compiled with FPC 2.2.4 will run '/bin/ls' instead.
7979- **Reason**: Security. Unix-users don't expect that files in the current directory are executed in favour of those in the system path.
8080- **Remedy**: If you really want to execute an executable in the current directory, use './exec-name' as executable name.
8181
8282## Non-x86 and non-linux/ppc64 systems
8383
8484### Floating point rounding
8585
8686- **Old behaviour**: On these platforms, the *round()* function always rounded to the nearest integer, halfway away from zero.
8787- **New behaviour**: By default, *round()* now performs *banker's rounding* (round-to-nearest, halfway to even). If the rounding mode is changed using the *Math* unit's *SetRoundMode()* function, the *round()* function now honours this change.
8888- **Example**:
8989
9090``` pascal
9191begin
9292 write(round(-2.5),' ');
9393 write(round(-1.5),' ');
9494 write(round(-0.5),' ');
9595 write(round(0.5),' ');
9696 write(round(1.5),' ');
9797 writeln(round(2.5));
9898end.
9999```
100100
101101The above program used to print:
102102
103-` -3 -2 -1 1 2 3`
103+```text
104+ -3 -2 -1 1 2 3
105+```
104106
105107Now it will print:
106108
107-` -2 -2 0 0 2 2`
109+```text
110+ -2 -2 0 0 2 2
111+```
108112
109113- **Reason**: Compatibility with TP/Delphi.
110114- **Remedy**: If you want to use other kinds of rounding, you can change the rounding mode using *Math.SetRoundMode()*, or use John Herbster's unit attached to [bug report 12687](http://bugs.freepascal.org/view.php?id=12687).
111115
112116## Windows Platforms
113117
114118### Functions removed from the Windows unit
115119
116120- **Old behaviour**: The following functions were declared in the Windows unit (including *A* and *W* variants where applicable):
117121 - comdlg32.dll:
118122 - *ChooseColor*
119123 - *ChooseFont*
120124 - *CommDlgExtendedError*
121125 - *CreateStatusWindow*
122126 - *FindText*
123127 - *GetFileTitle*
124128 - *GetOpenFileName*
125129 - *GetSaveFileName*
126130 - *PageSetupDlg*
127131 - *PrintDlg*
128132 - *ReplaceText*
129133 - comctl32.dll (and some helper routines):
130134 - *CreateMappedBitmap*
131135 - *CreatePropertySheetPage*
132136 - *CreateToolbarEx*
133137 - *CreateUpDownControl*
134138 - *DrawInsert*
135139 - *DrawStatusText*
136140 - *GetEffectiveClientRect*
137141 - *ImageList_Add*
138142 - *ImageList_AddIcon*
139143 - *ImageList_AddMasked*
140144 - *ImageList_BeginDrag*
141145 - *ImageList_Create*
142146 - *ImageList_Destroy*
143147 - *ImageList_DragEnter*
144148 - *ImageList_DragLeave*
145149 - *ImageList_DragMove*
146150 - *ImageList_DragShowNolock*
147151 - *ImageList_Draw*
148152 - *ImageList_DrawEx*
149153 - *ImageList_EndDrag*
150154 - *ImageList_GetBkColor*
151155 - *ImageList_GetDragImage*
152156 - *ImageList_GetIcon*
153157 - *ImageList_GetIconSize*
154158 - *ImageList_GetImageCount*
155159 - *ImageList_GetImageInfo*
156160 - *ImageList_LoadImage*
157161 - *ImageList_Merge*
158162 - *ImageList_Remove*
159163 - *ImageList_Replace*
160164 - *ImageList_ReplaceIcon*
161165 - *ImageList_SetBkColor*
162166 - *ImageList_SetDragCursorImage*
163167 - *ImageList_SetIconSize*
164168 - *ImageList_SetImageCount*
165169 - *ImageList_SetOverlayImage*
166170 - *LBItemFromPt*
167171 - *MakeDragList*
168172 - *MenuHelp*
169173 - *PropertySheet*
170174 - *ShowHideMenuCtl*
171175- **New behaviour**: These function have been removed from the Windows unit.
172176- **Reason**: Delphi compatibility, remove definitions of functions also declared in the *commdlg* and *commctrl* units.
173177- **Remedy**: Add the *commdlg* and/or *commctrl* unit(s) to your uses clause.
174178
175179---
176180*From the Free Pascal wiki, page "User Changes 2.2.4", as it stood on 2020-03-03 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
177181Category: FPC User Changes by release
178182Category: Release Notes

Back to history