Jump to content

Lars Fosdal

Administrators
  • Content Count

    3243
  • Joined

  • Last visited

  • Days Won

    105

Lars Fosdal last won the day on February 21

Lars Fosdal had the most liked content!

Community Reputation

1698 Excellent

Technical Information

  • Delphi-Version
    Delphi 12 Athens

Recent Profile Visitors

9836 profile views
  1. Lars Fosdal

    How to check for Delphi update?

    If there is a new version or patch for the IDE, it also will show up on the Welcome page.
  2. Lars Fosdal

    Variable not initialized?

    Frequent scenario function Test: integer; var i: integer; begin try i := 1; // do something finally; Result := i; end; end; i needs to be initialized before the try block.
  3. Lars Fosdal

    Hunting a unit reference

    Peganza is another possible tool to find out which unit that drags in another unit.
  4. @riev96 cglm.ini file will not help you. There is no license info in that file. SLIP files, on the other hand, are personal, and not to be shared.
  5. Lars Fosdal

    Simple LiveBindings usage questions

    Personally, I shun LiveBindings. In my experience, they are slow and fragile. Disclaimer: I haven't tried them since the version of Delphi when they first arrived.
  6. Lars Fosdal

    TFrame versus SubForm

    I've never tried working with subforms, so I can't say much about that.
  7. Lars Fosdal

    TFrame versus SubForm

    Another benefit is that we usually wait with initializing the frames until they are actually used. Saves init time on app startup.
  8. Lars Fosdal

    TFrame versus SubForm

    We use a lot of frames, but we almost always instantiate, reparent and connect them at runtime. Usually, we have a panel as a "host" for the frame, which lets the panel deal with the in-form alignment, so that the frame can use alClient. As @Davide Angeli mentions, loss of events has been a key factor for deciding to do it that way.
  9. Lars Fosdal

    company search tools question

    MS Copilot might be able, but, yeah, elbow grease FTW.
  10. Lars Fosdal

    Delphi and "Use only memory safe languages"

    That feels almost like you're advocating the use of FreeAndNil 😄
  11. Which again makes me wonder why not SELECT SUM(Field1) AS Total FROM YourSourceView but as mentioned, I suspect the example differs from the real world need...
  12. Doh, you are right, Uwe!
  13. Not sure if Totalling fields is the best example for the use case, as that is far more efficient to do in the queries By API, do you mean the interface section of the class? The challenge is that you need a predictable way to associate the fields with the field name. You could write a routine like this procedure ConnectFields(Query: TDataSet; const Fields: TArray<TField>; const Names: TArray<string>); begin Assert(Length(Fields) = Length(Names), 'Number of fields and number of names must match'); for var ix := 0 to Length(Fields) - 1 do begin Fields[ix] := Query.FieldByName(Names[ix]); if not Assigned(Fields[ix]) then raise Exception.Create(Format('Field %s not found.', [Names[ix]]); end; end // usage var Field1, Field2, Field3, Field4: TField; begin ConnectFields(Query, [ Field1, Field2, Field3, Field4], ['Field1', 'Field2', 'Field3', 'Field4']); ... which doesn't save you that much code, really.
  14. Are you doing this within a class or multitude of classes, or is it within a method or multitude of methods? Is TField your own class?
  15. So it is not about visual use? If not, I need to understand more about how the TFields will be used.
×