Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 01/23/23 in all areas

  1. programmerdelphi2k

    Threaded FTP and Timeouts

    I think that is your "Form1" usage into a thread! try some like this: unit Unit2; interface uses System.Classes, System.SysUtils, System.Threading, // IdBaseComponent, // IdComponent, // IdTCPConnection, // IdTCPClient, // IdExplicitTLSClientServerBase, IdFTP; type TMyProc = procedure(AValue: string) of object; // your params... TMyThread = class(TThread) private FIdFTP : TIdFTP; FProc : TMyProc; FFileToTransfer: string; protected procedure Execute; override; public constructor Create(const ASuspended: boolean; const AFileToTransfer: string; const AProc: TMyProc); destructor Destroy; override; // // etc... end; implementation { TMyThread } constructor TMyThread.Create(const ASuspended: boolean; const AFileToTransfer: string; const AProc: TMyProc); begin inherited Create(ASuspended); // FreeOnTerminate := true; FIdFTP := TIdFTP.Create(nil); FProc := AProc; FFileToTransfer := AFileToTransfer; end; destructor TMyThread.Destroy; begin FIdFTP.Free; // inherited; end; procedure TMyThread.Execute; begin if (FIdFTP = nil) or (FFileToTransfer='') then exit; // // ... use "FIdFTP" now with your FFileToTransfer or a list of files... { TThread.Synchronize(nil, procedure begin // update your UI here... end); // // or just if Assigned(FProc) then FProc('hello world'); // this run in your main-thread = app! } end; end. type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private procedure MyUpdateUI(AParam: string); // your procedure... your params public end; var Form1: TForm1; implementation {$R *.dfm} uses Unit2; procedure TForm1.MyUpdateUI(AParam: string); begin // what to do? end; procedure TForm1.Button1Click(Sender: TObject); var MyThread: TMyThread; begin MyThread := TMyThread.Create(true, 'myfile.txt', MyUpdateUI); MyThread.Start; end; end.
  2. FPiette

    Better way to maintain a list in a database table??

    Depending on what you need to do with the log (For example searching), you may simply use a text file and append the line at the end of the file. That is how most log files are built. If you are running on Windows, you may also use the Windows Event Log feature for which there is an API. And of course using a database is also an option. How to select between those solution and probably other depends on your use case that you don't describe at all...
  3. Fr0sT.Brutal

    D11.2 + FireDAC + MySQL 64 bit not working

    amd-x64.nvidia-geforce.ms-win7.asus-monitor.genius-mouse.logitech-keyboard.en.delphipraxis.net 🙂
  4. programmerdelphi2k

    Select multiples lines at once

    if Im not wrong, since D2005 (period, comma brakr5 NOT , just text) typo fault you can use TAB key to jump between text. you use Allows (moving)for dont delete text while typing new text. attached a pdf with more info Delphi2005Refactoring.pdf I love Ctrl+D and Ctrl+Shift+J all day recorded in RAD 11.2 ALexandria = Ctrl+Shift+J and regular text replacement...
  5. programmerdelphi2k

    Select multiples lines at once

    @Zazhir this is the "Ctrl+Shift+J" that I said above!
  6. aehimself

    D11.2 + FireDAC + MySQL 64 bit not working

    You really never heard of amd-x64.google.com or itanium64.en.delphipraxis.net? 😄
  7. A.M. Hoornweg

    Tlist<T> growth strategy is bad.

    Please ignore my previous post. It appears I was incorrect about my assumption that the size of the list is always increased by one, it uses "GrowCollection" from unit Sysutils which is a more clever strategy.
  8. Lars Fosdal

    GameVision Toolkit

    I haven't been on Facebook since 2018, and I am not going there again.
  9. David Heffernan

    "Divided by zero" exception

    Do yourself a favour and check whether exceptions are masked in the two programs at the point where exveptions are raised.
×