Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

1 Neutral

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Anyone know how to get rid of this?
  2. Gary

    Problem with TBGrid connected to SQLite

    Not sure what you mean by "change caption for different fields". You can do this at design time by right click fdTable and open field editor, right click and add all fields (or the ones you want), then set the DisplayLabel property of each field. Hope that helps
  3. I do something similar to Danny. DBControls and TDataSource on form, Devart components on a TDataModule. I have a unit between them, but to avoid having your form reference the DataModule you can assign them at runtime TForm.TDataSource.DataSet := TDataModule.TMyQuery. Also it seems that your customer knows his way around a database. You might have a look at http://www.rosinsky.cz/delphi/ Thomas has a filter dialog, as well as a Grid properties dialog that allows the end user to select the grid columns and create filters almost as good as a SQL statement Gary
  4. Ya, so is it bad practice to have a simple class like TReminderItem = class public EmployeeID: Integer; EmployeeName: String; HireDate: TDate; LastDate: TDate; Notes: String; end; without the requisite properties, getters and setters just to move data around?
  5. Thanks Stefan, I have always been confused by records and pointers, but with the new custom managed records wanted to give it another try since it looks like records for just data storage are simpler to work with than classes. I will probably just use a class with simple properties but here is the revised code with record pointer. I do need to change Data as I will use the record to read data from a database and fill the list with records. TReminderItem = record FEmployeeID: Integer; FEmployeeName: String; FHireDate: TDate; FLastDate: TDate; FNotes: String; end; PReminderItem = ^TreminderItem; procedure TForm1.Button1Click(Sender: TObject); var LList : TList<PReminderItem>; LReminderItem : PReminderItem; begin LList := TList<PReminderItem>.Create; try GetReminder(LList); ShowMessage(Format('Name: %s', [LList[0]^.FEmployeeName])); finally for LReminderItem in LList do Dispose(LReminderItem); LList.Free; end; end; procedure TForm1.GetReminder(AList: TList<PReminderItem>); var LReminderItem : PReminderItem; begin // LReminderItem := TReminderItem.Create; New(LReminderItem); LReminderItem^.FEmployeeID := 1; LReminderItem^.FEmployeeName := 'Test Name'; LReminderItem^.FHireDate := Now; LReminderItem^.FLastDate := Now; LReminderItem^.FNotes := 'A Note'; AList.Add(LReminderItem); end; Thanks again Gary
  6. So how do I do it? I have tried Dispose, finally for LReminderItem in LList do Dispose(LReminderItem); LList.Free; end; I get a compiler error incompatible type if I try (No doubt wrong) using the correct type var PReminderItem : ^TReminderItem; and finally for LReminderItem in LList do begin PReminderItem := @LReminderItem; Dispose(PReminderItem); end; LList.Free; end; It compiles but I get an exception Also David notice the list is indeed a TList<TReminderItem>. if I just leave out the attempt to free the memory and just free the List I get the Memory leak
  7. Delphi 10.4.1 Windows 10 Why does this leak memory? FastMM4 reports A memory block has been leaked. The size is: 36 This block was allocated by thread 0x948, and the stack trace (return addresses) at the time was: 4070A2 [System.pas][System][@GetMem$qqri][4843] 40A0F7 [System.pas][System][@NewUnicodeString$qqri][25659] 40A584 [System.pas][System][@UStrAsg$qqrr20System.UnicodeStringx20System.UnicodeString][26643] 615C6A [Unit1.pas][Unit1][TForm1.GetReminder][65] 616166 [Unit1][Generics.Collections.%TList__1$19Unit1.TReminderItem%.Create] 615A34 [Unit1.pas][Unit1][TForm1.Button1Click][46] 770168CF [GetWindowLongW] 720A55DC [Unknown function at SetWindowSubclass] 4086D3 [System.pas][System][@IsClass$qqrxp14System.TObjectp17System.TMetaClass][18453] 553531 [Vcl.Controls.pas][Vcl.Controls][Controls.TControl.Click][7596] 56C28B [Vcl.StdCtrls.pas][Vcl.StdCtrls][Stdctrls.TCustomButton.Click][5609] type TReminderItem = record public RecordID: Integer; EmployeeID: Integer; EmployeeName: String; HireDate: TDate; LastDate: TDate; Notes: String; procedure Clear; end; TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private procedure GetReminder(AList: TList<TReminderItem>); end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); var LList : TList<TReminderItem>; LReminderItem : TReminderItem; PReminderItem : ^TReminderItem; begin LList := TList<TReminderItem>.Create; try GetReminder(LList); ShowMessage(LList[0].EmployeeName); finally for LReminderItem in LList do LReminderItem.Clear; LList.Free; end; end; procedure TForm1.GetReminder(AList :TList<TReminderItem>); var LReminderItem: ^TReminderItem; begin New(LReminderItem); LReminderItem.RecordID := 1; LReminderItem.EmployeeID := 1; LReminderItem.EmployeeName := 'Test'; LReminderItem.HireDate := Now; LReminderItem.LastDate := Now;; LReminderItem.Notes := 'A Note'; AList.Add(LReminderItem^); end; { TReminderItem } procedure TReminderItem.Clear; begin Self := Default(TReminderItem); end; This is just my latest attempt, I have tried Finalize, FinalizeRecord, FreeMem. The Clear procedure is also an attempt after seeing it in a different post. What is the proper way to free memory of a record I create in a list? Thanks in advance, Gary Unit1.pas Unit1.dfm
  8. For me as well! Thanks Uwe
  9. I have the same problem Access Violation ntdll.dll Also worked fine in 10.4.1 Still works just gives violation on startup From their blog Pascal Analyzer, Pascal Browser and Pascal Expert support Delphi 10.4! August 7, 2020
  10. Gary

    Database in Delphi

    Do you have tblConts linked in any way to other tables? Master/Detail?
  11. Bought the eBook recently. On chapter 8. I found several tips and explanations already that made it more than worth the price.
  12. Maybe a long shot...I have this happen from time to time and the problem is TestInsight, for no reason the 'run tests continually when idle' gets selected. IDE will seem to hang because tests are running. Drove me crazy until I found it.
  13. Gary

    Are there any free DBGrid components out there?

    I use http://www.rosinsky.cz/delphi/ his DB controls including grid are $70 whole package that includes some excellent dialogs for end user is $95. He is very responsive to support.
  14. The problem is not with MMX but AQTime. Once I finished test driving AQTime and started work I found that it hijacked the right click. I no longer had the Delphi popup. Removed both, Re-Installed AQTime - no Delphi popup just AQTime. Removed AQTime Re-Install MMX - All is good in code land again!!
  15. Awesome just to get a response!! And on a Sunday playoff weekend