Jump to content

RaelB

Members
  • Content Count

    72
  • Joined

  • Last visited

Posts posted by RaelB


  1. Hi,

    I am needing to store a large number of small images, e.g. 10,000+ images (so could be 50,000 or more..), where each image is around 30kb. Generally I will not be iterating through all of them. Main operations are check if exists, load, and save.

    I'm considering to use the filesystem for this purpose, as apposed to using a database e.g. sqlite.

    Is there any downside to using the filesystem in this scenario?

    Thanks


  2. Hi,

    I've been looking at this YT Video: "First look at Delphi 10.4.2 on Windows 11 ARM & macOS 12 ARM" (youtube watch?v=9p4cL1wt8bk) from which it sounds like Delphi apps are able to run on Windows 11 ARM. However, I have a user who says that my app does not start at all on Windows 11 ARM. Should it in fact be able to run?

    Thanks


  3. Thanks for the tip. I am using HotKeyManager, and looking at the source I see that it is calling LoadKeyboardLayout, and that is what is causing the problem.

     

    10 hours ago, aehimself said:

    Does the app call LoadKeyboardLayout without KLF_SETFORPROCESS?

    Not sure if that will make a difference. Documentation says "Beginning in Windows 8: This flag is not used. "

     


  4. I create a number of Frames and store them in a Frame Object List (declared as FFrames: TObjectList<TMyFrame>)

    The frames are also added to the VCL form.

     

    I try to replace a Frame with below code, but it results in an "Invalid Pointer Operation": (I'm replacing the last Frame in the list with a new one)

     

    procedure TForm1.btnReplaceClick(Sender: TObject);
    var
      NewFrame: TMyFrame;
      OldFrame: TMyFrame;
    begin
      if FFrames.Count = 0 then exit;
    
      NewFrame := GetNewFrame;
      OldFrame := FFrames[FFrames.Count - 1];
      FFrames[FFrames.Count - 1] := NewFrame;
      OldFrame.Free;
    end;

    What's wrong with the code?

     

    Full code follows:

     

    unit Unit1;
    
    interface
    
    uses
      Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
      Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls,
      System.Generics.Collections, MyFrameU;
    
    type
      TForm1 = class(TForm)
        ScrollBox1: TScrollBox;
        btnAdd: TButton;
        btnReplace: TButton;
        procedure btnAddClick(Sender: TObject);
        procedure btnReplaceClick(Sender: TObject);
        procedure FormDestroy(Sender: TObject);
        procedure FormCreate(Sender: TObject);
      private
        { Private declarations }
        FFrames: TObjectList<TMyFrame>;
        function GetNewFrame: TMyFrame;
      public
        { Public declarations }
      end;
    
    var
      Form1: TForm1;
      Counter: Integer;
    
    implementation
    
    {$R *.dfm}
    
    procedure TForm1.FormCreate(Sender: TObject);
    begin
      FFrames := TObjectList<TMyFrame>.Create;
    end;
    
    procedure TForm1.FormDestroy(Sender: TObject);
    begin
      FFrames.Free;
    end;
    
    function TForm1.GetNewFrame: TMyFrame;
    begin
      Result := TMyFrame.Create(Self);
      Result.Name := 'MyFrame' + Counter.ToString;
      Result.Parent := ScrollBox1;
      Result.Align  := alLeft;
      Result.SetName(Result.Name);
      Inc(Counter);
    end;
    
    procedure TForm1.btnAddClick(Sender: TObject);
    var
      Frame: TMyFrame;
    begin
      Frame := GetNewFrame;
      FFrames.Add(Frame);
    end;
    
    procedure TForm1.btnReplaceClick(Sender: TObject);
    var
      NewFrame: TMyFrame;
      OldFrame: TMyFrame;
    begin
      if FFrames.Count = 0 then exit;
    
      NewFrame := GetNewFrame;
      OldFrame := FFrames[FFrames.Count - 1];
      FFrames[FFrames.Count - 1] := NewFrame;
      OldFrame.Free;
    end;
    
    end.

     


  5. The GUI examples work fine for demonstration purposes, but how do I use the components to execute python code and get a result within my own code, i.e synchronous execution, or be notified when execution is done?

    e.g:

    S := PythonExec(input_script)

     

    Then I can use S in next line of code, or in an event that notifies script is done.

    Thanks

×