Lajos Juhász
-
Content Count
838 -
Joined
-
Last visited
-
Days Won
11
Posts posted by Lajos Juhász
-
-
-
7 minutes ago, Fr0sT.Brutal said:Often you can find code
I never saw this kind of code, I saw:
if Assigned(obj) then
obj.free;
Most of the time I only saw that a "developer" refuses to use free instead of FreeAndNil. -
10 minutes ago, Der schöne Günther said:If that is all, how can you even have an opinion on that? What is there to talk about? Can somebody get me up to date with just one or two sentences?
My guess is that they'll try to proove that you can use free instead of freeandnil. Often you can find code:
var
X: TMyImportantForm;
begin
x:=TMyImportantForm.create(self);
try
... some boring code ....
finally
FreeAndNil(x);
end;
end;
-
Why not? Until it's removed from the language this topic will remain important. Unfortunately I believe even if it will be eventually removed everyone will create a private copy and continue to use that as an "important tool".
-
Tested with a persistent field and set the PK. It doesn't make a difference I still get:
Project Project1.exe raised exception class EFDException with message '[FireDAC][Comp][DS]-200. Bookmark is not found for dataset [FDQuery1]'.Maybe UniDAC has a different implementation for bookmarks.
-
I've tested with fireDAC, the bookmark is never valid after reopen (however will find the record if you don't scroll the scrollbar). After every scroll I get:
with a call stack:
:763ec3a2 KERNELBASE.RaiseException + 0x62
FireDAC.Stan.Error.FDException(nil,???,26209084,???)
FireDAC.Stan.Error.FDException($37E6CA0,???,200,???)
FireDAC.Comp.DataSet.ErrorNoBmk
FireDAC.Comp.DataSet.TFDDataSet.InternalGotoBookmark(???)
FireDAC.Comp.DataSet.TFDDataSet.InternalGotoBookmark((144, 138, 137, 3, 81, 0, 0, 0, 5, 0, 0, 0))
Data.DB.TDataSet.GotoBookmark((144, 138, 137, 3, 81, 0, 0, 0, 5, 0, 0, 0))
Unit1.TForm1.Button1Click($37E6930)I know that this was the case with BDE, DBX and now FireDAC.
For the reference my code is:
procedure TForm1.Button1Click(Sender: TObject);
var
lbm: TBookmark;
begin
lbm:=fdquery1.Bookmark;
fdquery1.Close;
fdquery1.Open;if not FDQuery1.BookmarkValid(lbm) then
ShowMessage('Not Valid!');fdquery1.Bookmark:=lbm
end;
-
1 hour ago, Attila Kovacs said:Huh? Since when is that?
Since Delphi 1. If you close and reopen the query the bookmark is invalid.
-
When you refresh the data the bookmark will no longer be valid. It's a pure luck if you don't see an error message. You shold remember the key of the active record before the refresh and call locate for it.
-
In that case you use the AddIndex merhod. For more information: https://docwiki.embarcadero.com/Libraries/Sydney/en/Datasnap.DBClient.TCustomClientDataSet.AddIndex here you can find a helper procedure https://edn.embarcadero.com/article/29056 to sort.
- 1
-
13 minutes ago, Incus J said:Naive question: If they expect you to implement the form destruction event manually, what is the actual purpose of the OnDestroy event property in the object inspector?
It's a bit different when the form is destroyed while application is running and when the application is closed / terminated. (The OS should/will clean up anything that is not freed by application.)
-
You have to set a flag inside the button3 onclick event handler. Later when needed you can check that flag and reset it.
-
6 hours ago, Alexandre Jacquot said:Could you (@Lajos Juhász ) tell us If you have Visual Studio installed?
Of course I don't have. I am a Delphi developer.
-
You can upload a zip file with a project and or a txt file with the description that will be not altered by the site.
-
42 minutes ago, Incus J said:Should be OK if your app is only intended for Windows 10 and up.
Since the per-monitor dpi (v1) was introduced in Win 8.1 there should programs also work.
-
SynEdit is not part of the Delphi so it's hardly changed with Delphi upgrade.
-
Maybe you have an unpatched M1 chip. Working fine here in Chrome, Firefox and Edge.
-
7 minutes ago, msd said:Delphi is not a problem; it works fine.
Please send me a copy of D11.1 that works fine. I did my best to support highDPI unfortunately I see no way to do that with D11.1 maybe in D14 will work.
- 1
- 1
-
You can try $(BDSCOMMONDIR)\styles
or $(BDSUSERDIR)\styles
-
6 minutes ago, RonaldK said:Is there still a roadmap for Delphi? I haven't found any more.
Of course there is. It's true that the public roadmap is a bit old. However the company thinks that it's not important to inform us when we can expect a release or on what they're working now.
-
In VCL most probably you had turned off Range check and in FMX left it on.
-
In D11 you should check out also TCardPanel its made to replace that hack with TPageControl. Be aware it's not perfect yet will take a couple of versions to remove the bugs.
- 1
-
I've downloaded the source. There the data structure is not good for this task. I don't know when will have the time to write some example how would I desing it. This weekend is/was busy for me.
-
The text on the image that you've attached is not readable. As far as I can see you're using ODBC connection that is not configured on that PC. Be aware that windows have a 32 bit and 64 bit version of the ODBC Data Source Administrator and you have to create the data source in the one that matches your application. A 32 bit application cannot connect to 64 bit data source.
-
FreeAndNil() - The Great Delphi Developer Debate
in Tips / Blogs / Tutorials / Videos
Posted
(I) Wrong comment. a is a local variable and doesn't have to be nil. Thus the nil is required to signal that there is no object assigned to variable a.
(II) In this code a is nil or a valid reference thus it's not required to check if it's nil that will be done in the free method. In the next line it's not required to assign nil to a. A is a local variable and finally after the finally it will go out of scope.