Jump to content

Uwe Raabe

Members
  • Content Count

    2883
  • Joined

  • Last visited

  • Days Won

    169

Everything posted by Uwe Raabe

  1. The current implementation of one overload of TTestDataProvider.GetProvider looks like this: class function TestDataProviderManager.GetProvider(const AClass: TTestDataProviderClass) : ITestDataProvider; var key : string; begin result := nil; if (FList.ContainsValue(AClass)) then begin for key in flist.keys do begin if (flist[key] = AClass) then begin result := TTestDataProviderClass(flist[key]).Create; break; end; end; end; end; Is there any reason why that cannot be written as: class function TestDataProviderManager.GetProvider(const AClass: TTestDataProviderClass) : ITestDataProvider; begin result := AClass.Create; end; With that one could avoid registering the provider. The reasoning for my question is, that I have a base provider class and several derived classes to overcome the lack of ability to parametrize a data provider instance. All these derived classes are local to one test unit and I would like all of them to have the same class name. Unfortunately the registration requires me to give distinct names for them and you know - naming is hard. Just declaring the derived class and use that in a TestCaseProvider attribute would simplify this a lot. Concrete: TTestDataFilesProvider provides a list of files, but requires the path and search pattern as parameters. Now I derive individual classes (with fixed values) immediately before they are used.
  2. Uwe Raabe

    TFDScript.ExecuteALL does not seem to behave as expected

    Perhaps you are just expecting something the method isn't intended for. ExecuteAll doesn't execute all scripts in the SQLScripts collection. It only executes the first one (the main script), while the others are meant as subscripts to be called by name from the main script or other subscripts. This is an example from the docs: with FDScript1.SQLScripts do begin Clear; with Add do begin Name := 'root'; SQL.Add('@first'); // explicitly call 'first' script SQL.Add('@second'); // explicitly call 'second' script end; with Add do begin Name := 'first'; SQL.Add('create table t1 (...);'); SQL.Add('create table t2 (...);'); end; with Add do begin Name := 'second'; SQL.Add('create procedure p1 (...);'); SQL.Add('create procedure p2 (...);'); end; end; FDScript1.ValidateAll; FDScript1.ExecuteAll; That said, TFDScript is not a container for scripts to be executed in sequence by calling ExecuteAll. That has to be done by your own code.
  3. Uwe Raabe

    Save Timage picture as png

    What graphic class is image? You can retrieve that from imgPerson.Picture.Graphic.Classname
  4. In that case changing that field value inside the program seems a pretty rare case. The shown queries give the impression that some dummy fields are returned with no relation to the data in the database. As there are better ways to create such fields in the program it makes the query the wrong place for it.
  5. Exactly! The approach used in the query is just the wrong one.
  6. Uwe Raabe

    Write image to database

    That's correct. So we need to know the Delphi version being used.
  7. Uwe Raabe

    Write image to database

    What about using TDBImage instead of TImage?
  8. As mentioned in this blog post: Available Today: the C++Builder and RAD Studio 11.1.5 C++ Code Insight Update (emphasizes by me):
  9. procedure TForm1.SomeControlEvent(Sender: TObject); begin var myLabel: TLabel; if Sender.Supports<TLabel>(myLabel) then myLabel.Caption := 'handled'; end;
  10. Thinking out of the box here: type TSupport = class helper for TObject public function Supports<T: class>(out ResObj: T): Boolean; end; function TSupport.Supports<T>(out ResObj: T): Boolean; begin ResObj := nil; if Self is T then begin if not ((Self is TBoldObject) and TBoldObject(Self).BoldObjectIsDeleted) then ResObj := T(Self); end; result := ResObj <> nil; end;
  11. That would require to pass a TObject variable to that parameter, which is not helpful. An out parameters works like a var parameter, where the types must match exactly.
  12. Which version of Pascal Analyzer do you use? I couldn't reproduce it here.
  13. You might be interested in the Delta property of TFDQuery.
  14. Uwe Raabe

    Function with 2 return values ?

    Hey, we also have TPair<Double, Double>.
  15. Uwe Raabe

    Function with 2 return values ?

    According to that list, that would be better named TDouble?
  16. Uwe Raabe

    Function with 2 return values ?

    You can return a TArray<Double>: function GetBomCosts(const ItemCode : String) : TArray<Double>; begin { Retrieve values } ... { Return values as array } SetLength(Result, 2); Result[0] := value1; Reuslt[1] := value2; end;
  17. Uwe Raabe

    Compiling a component for Win64

    IIRC, that separation has been suggested since Delphi 6.
  18. Uwe Raabe

    Converting a very long text to concatenated strings?

    Not quite. The MultiPaste expects some text containing multiple lines.
  19. Uwe Raabe

    Compiling a component for Win64

    You need separate packages for runtime and design.
  20. Uwe Raabe

    MultiDisplay : choose specific display on boot

    It works as expected when I place the following code in FormCreate: var displayIndex := Screen.DisplayCount - 1; var display := Screen.Displays[displayIndex]; SetBoundsF(display.Workarea.Left, display.Workarea.Top, Width, Height);
  21. Uwe Raabe

    MultiDisplay : choose specific display on boot

    You cannot directly set a specific display. Instead you position the form so that it is shown on the desired display.
  22. Uwe Raabe

    Debug / Release config has no effect

    I would rather like to know which magic makes your system behave different than most others.
  23. Uwe Raabe

    How do I update the sqlite dll in RAD Studio?

    You know that there is a place for such wishes?
  24. https://quality.embarcadero.com/browse/RSP-16511
  25. Uwe Raabe

    How do I update the sqlite dll in RAD Studio?

    The Client info mentions <sqlite3_x86.obj statically linked> That means the SQLite engine is part of the exe or bpl. You cannot change that for the IDE.
×