Jump to content

Uwe Raabe

Members
  • Content Count

    2919
  • Joined

  • Last visited

  • Days Won

    170

Everything posted by Uwe Raabe

  1. Uwe Raabe

    Modelmaker integration

    The code for checking the presence of a Delphi IDE is like this: function IsDelphiIDEInstalled(IDEVersion: TDelphiIDEVersion): Boolean; var R: TRegistry; begin R := TRegistry.Create; try R.RootKey := HKEY_LOCAL_MACHINE; Result := R.OpenKeyReadOnly(DelphiIDEKey(IDEVersion)); finally R.Free; end; end; DelphiIDEKey evaluates to Software\Embarcadero\BDS\%d.0 for the newer versions. Note that ModelMaker is only aware of BDS versions up to 19.0 (Delphi 10.2 Tokyo). You might get away with just creating the base key for a non-installed version to trick ModelMaker into looking for the expert. So adding HKLM\Software\Embarcadero\BDS\19.0 to the registry should get you going.
  2. Uwe Raabe

    Modelmaker integration

    Is this in HKEY_LOCAL_MACHINE? If yes, there might be other criteria being checked for existence of a Delphi version. I'm willing to investigate, but my possibilities in regard to ModelMaker are a bit limited compared to MMX.
  3. Uwe Raabe

    Modelmaker integration

    That's possible. IIRC ModelMaker looks for the BDS\xx.x\Experts key in HKLM.
  4. Uwe Raabe

    Modelmaker integration

    Same here and this is how the dialog looks here:
  5. Uwe Raabe

    Modelmaker integration

    I couldn't reproduce, but I am on 12.3 here. Can you give detailed steps to reproduce? Perhaps I tested something plain simple while the real problem is more complex.
  6. Well, in this case you can. I did a lot of refactoring such code myself during the last decades. The constraint you suggested to remove is a good indicator of progress in such an endeavor.
  7. Uwe Raabe

    High-dpi scaling problems with TFrame

    There are several bugs fixed in 12.2 and 12.3 affecting frames. https://quality.embarcadero.com/browse/RSP-37402 https://quality.embarcadero.com/browse/RSP-39847 https://quality.embarcadero.com/browse/RSP-40110 https://quality.embarcadero.com/browse/RSP-43560 https://embt.atlassian.net/servicedesk/customer/portal/1/RSS-1020 Perhaps these will fix your problem, too. I will test your project later when I've found some time to configure my system for monitors with different dpi.
  8. Uwe Raabe

    restore ansi from utf8

    I just took what the OP wrote and show a way to revert any file somehow changed from ANSI to UTF-8. I never said it is a silver bullet for all circumstances.
  9. Uwe Raabe

    restore ansi from utf8

    Because it is the reverse of what Notepad in Windows 11 did to the files.
  10. Uwe Raabe

    restore ansi from utf8

    Load the file with UTF-8 encoding and save it with ANSI encoding. uses System.IOUtils; ... TFile.WriteAllText(FileName, TFile.ReadAllText(FileName, TEncoding.UTF8), TEncoding.ANSI); If the files are too large to fit into memory, you need to work with different file names for input and output: var writer := TStreamWriter.Create(NewFileName, False, TEncoding.ANSI); try var reader := TStreamReader.Create(FileName, TEncoding.UTF8); try while not reader.EndOfStream do writer.WriteLine(reader.ReadLine); finally reader.Free; end; finally writer.Free; end;
  11. Uwe Raabe

    restore ansi from utf8

    Isn't the root problem where you read these strings in the wrong way and shouldn't it be handled right there?
  12. Uwe Raabe

    RAD Studio 12.3: E2213 Bad packaged unit format

    Looks to me like some caching problem in the IDE. As you seem to have reproducible steps, you should file a bug report.
  13. Uwe Raabe

    TControlList and colors/selection

    You can avoid that by setting MarkDisabledItem to False.
  14. Uwe Raabe

    TControlList and colors/selection

    Add an event handler for OnEnableItem and set AEnabled := False;
  15. Uwe Raabe

    FireDAC encrypted SQLite DB with Delphi 12.3 x64

    If you can reproduce with a small sample database I suggest to file a bug report at https://qp.embarcadero.com/
  16. Uwe Raabe

    FireDAC encrypted SQLite DB with Delphi 12.3 x64

    According to the unit mentioned, the libraries named sqlite3_fde_x64.obj/sqlite3_fde_x86.obj are used. They come with Delphi and are located in subfolders of $(BDSLIB).
  17. Uwe Raabe

    TForm to TForm communication

    First, declare the message type in a common unit: type TIntegerMessage = class(TMessage<Integer>); Second, declare a TMessageListenerMethod in FormA handling that message type: type TFormA = class(TForm) ... private procedure MyMessageHandler(const Sender: TObject; const M: TMessage); ... procedure TFormA.MyMessageHandler(const Sender: TObject; const M: TMessage); begin var msg := M as TIntegerMessage; // do something with the Integer you get from msg.Value end; Third, subscribe/unsubscribe to this message type in TFormA.FormCreate/FormDestroy: procedure TFormA.FormCreate(Sender: TObject); begin TMessageManager.DefaultManager.SubscribeToMessage(TIntegerMessage, MyMessageHandler); end; procedure TFormA.FormDestroy(Sender: TObject); begin TMessageManager.DefaultManager.Unsubscribe(TIntegerMessage, MyMessageHandler); end; Finally, send the message in FormB: begin ... TMessageManager.DefaultManager.SendMessage(Self, TIntegerMessage.Create(42)); ... end; Note: Only the common unit with the type declaration has to be used by both form units. None of them needs to use the other form unit.
  18. Uwe Raabe

    access violation changing font

    It seems to be reproducible reliably in the debugger, while without the debugger I can switch the size with or without errors and I was not able to identify a pattern, yet.
  19. Uwe Raabe

    Custom Time format in TDBGrid

    That would only help if you are using a Delphi version that supports it (i.e. Delphi 11.2 or higher). See https://docwiki.embarcadero.com/RADStudio/Alexandria/en/11_Alexandria_-_Release_2#Updated_FireDAC_Drivers
  20. Uwe Raabe

    Problem with Calculated fields in a TFDQuerry

    The value of calculated fields are only stored for the current record. As soon as you move to another one, the field content is lost. Therefore you need to calculate the field value several times, which can slow down performance when the calculation needs some time. A solution is to cache these values.
  21. Uwe Raabe

    Problem with Calculated fields in a TFDQuerry

    Calculating fields is done on each record at several occasions. Any change to the current record, be it by navigating or switch to and from edit mode. AfterOpen is dataset based and when it is called, at least the first record is already loaded and all fields contain their values, including the calculated ones.
  22. Uwe Raabe

    Problem with Calculated fields in a TFDQuerry

    I would use a caching approach. In OnCalcFields try finding the ID in the dictionary like you already do. If not found, get the file size as you currently do in OnAfterOpen and add it to the dictionary.
  23. It survives the change from Integer to an enumeration type.
  24. Not sure if this helps: Breakpoints are stored in the DSK file. Depending on whether you opened a project group or a standalone project (with that temporary project group created on the fly) this is the DSK file of the project group or the project.
  25. Uwe Raabe

    TButtonedEdit RightButton - OnMouseDown/OnMouseUp

    The TGlyph type being private and Glyph property being protected makes everything a bit cumbersome. Fortunately there is a trick to inject a message handler without subclassing. type TEditButtonHelper = class helper for TEditButton public procedure LinkMessageHandler; end; TGlyphMessageHandler = class(TWinControlMessageHandler) protected function HandleMessage(var Message: TMessage): Boolean; override; end; function TGlyphMessageHandler.HandleMessage(var Message: TMessage): Boolean; begin var edt := TButtonedEdit(Control.Parent); case Message.Msg of WM_LBUTTONDOWN: edt.PasswordChar := #0; WM_LBUTTONUP: edt.PasswordChar := '*'; end; Result := inherited; end; procedure TEditButtonHelper.LinkMessageHandler; begin Glyph.InitMessageHandler(TGlyphMessageHandler); end; procedure TForm1.FormCreate(Sender: TObject); begin ButtonedEdit1.RightButton.LinkMessageHandler; end;
×