Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 11/07/19 in all areas

  1. Der schöne Günther

    New TForm - Defaults

    Always have a base class for your forms/frames. When adding a new form/frame to your project, do not inherit from TForm/TFrame, inherit from TMyForm/TMyFrame.
  2. I've added a very useful feature to UCM: Showing the full file path of the selected unit in the StatusBar (this works in all tabs): Double-Clicking on the StatusBar copies the full file path displayed on the StatusBar to the clipboard! Here are the sources: GX_UsesExpert.zip Here is the link to the filed request: https://sourceforge.net/p/gexperts/feature-requests/82/
  3. Alexander Sviridenkov

    Right To Left Components

    @limelect AFAIK Hebrew doesn't have special connectors between letters so can be correctly rendered using separate symbols, but Arabic - can't.
  4. In Uses Clause Manager, double-clicking a unit item in the units list of any tab (except Identifiers) adds the double-clicked unit to the implementation uses clause. This functionality is still missing in the Identifiers tab in r2832, so I added it by adding the lbxAvailDblClick event handler to sg_Identifiers: Thomas, can you please commit this. Thank you! Here is the link to to the feature request: https://sourceforge.net/p/gexperts/feature-requests/81/
  5. Why are you using AnsiString at all? You should be using (Unicode)String instead, since that is what the TMemo expects. In any case, Char is WideChar in D2009+, so SizeOf(Char) is 2 not 1, so you are allocating memory for your AnsiString for only 1/2 of the file data, but then reading the full file into that memory. So you are going to corrupt surrounding memory. Use SizeOf(AnsiChar) instead, which is 1 so you can just drop the SizeOf() altogether. var LoadString: AnsiString; FS: TFileStream; begin FS := TFileStream.Create(FileName, fmOpenRead or fmShareDenyNone); try SetLength(LoadString, FS.Size); FS.ReadBuffer(Pointer(LoadString)^, FS.Size); finally FS.Free; end; Memo.Lines.Add(String(LoadString)); end; Alternatively, there are other options, such as TMemoryStream.LoadFromFile(): uses System.Classes; var LoadString: AnsiString; MS: TMemoryStream; begin MS := TMemoryStream.Create; try MS.LoadFromFile(FileName); SetString(LoadString, PAnsiChar(MS.Memory), MS.Size); finally MS.Free; end; Memo.Lines.Add(String(LoadString)); end; Or TStreamReader: uses System.Classes, System.SysUtils; var LoadString: String; Reader: TStreamReader; begin Reader := TStreamReader.Create(FileName, TEncoding.ANSI); try LoadString := Reader.ReadToEnd; finally Reader.Free; end; Memo.Lines.Add(LoadString); end; Or TFile.ReadAllText(): uses System.IOUtils, System.SysUtils; var LoadString: String; begin LoadString := TFile.ReadAllText(FileName, TEncoding.ANSI); Memo.Lines.Add(LoadString); end;
  6. ergeka

    Shellexecute @ UBUNTU platform

    Perhaps this gives an idea. https://chapmanworld.com/2017/04/06/calling-linux-commands-from-delphi/
×