Jump to content

Lajos Juhász

Members
  • Content Count

    1077
  • Joined

  • Last visited

  • Days Won

    15

Everything posted by Lajos Juhász

  1. I think this is a bad idea, however here is a code for VCL: procedure ShowForm ( ThisForm: TFormClass ) ; var lForm: TForm; begin lForm := ThisForm.Create(nil); try lForm.ShowModal; finally lForm.Free; end; end; {Example to use} procedure TForm1.Button1Click(Sender: TObject); begin ShowForm(Tform1); end; procedure TForm1.Button2Click(Sender: TObject); begin ShowForm(Tform2); end; The difference between VCL and Fmx is that in Fmx you've to define TFormClass: type TFormClass = class of TForm;
  2. Lajos Juhász

    How to set TBytes array to the file size ?

    It guess with the edit the source was removed. HexViewSource.zip
  3. Lajos Juhász

    How to set TBytes array to the file size ?

    Here is the content (I assume by Gary Darby): HexView will display the contents of any file using hexadecimal (base 16) digits. There are 16 hexadecimal digits with values 0 through 15 but labeled "0" through "9" and "A" though "F" for convenience. Each hex digit could also be written with 4 binary bits (0000 to 1111). Hexadecimal numbers are convenient for use in displaying computer memory or files because two of those 4 bit hex digits can represent the basic unit of memory storage, the 8-bit "byte" I've had a version of this one floating around for my own use for years, but just recently realized that i had never posted it. Use of the program is self explanatory; , select a file to browse and use PgUp, PgDn keys to page through it. Ctrl+PgUp will jump to page 1, Ctrl+PgDn will jump to the last page. The "Esc" escape key will close the file. Characters which represent valid characters will be displayed on each line beside the hexadecimal data. Programmer's Notes A TFileStream control is used to access the file to be displayed. In order to avoid memory problems with large files, the amount of data (BufLen) to fill a page is calculated for each display operation based on the current size of the TMemo control. For each page, procedure ShowPage seeks to the start of the next page to be displayed (CurPage*BufLen) and reads BufLen bytes of data. Hexchars is the array containing the 16 hexadecimal character labels. The Delphi code uses a loop on N and J to convert each byte for each line into two display characters and add it to the string, Hex. N reflects the position of the current line start within the buffer and J points tpo the current character being converted. The conversion line of code looks like this: hex:=hex+hexchars[(buffer[n+j] and $F0) shr 4] + hexchars[(buffer[n+j] and $0F)]; The left hand "nibble" (4 bits of a byte) is converted by "and"ing it with hex F0 (11110000 binary) to clear out the right side nibble and then shifted right (= divided by 16) to get it back in the range 0-15 which is then used as an index into the Hexchars array. The right half of the bite is then converted similarly except that there's no need to divide by 16.HexViewSource.zip The displayed lines are added to a TStringlist (List) whose strings are assigned to the Memo1.Lines property after the page has been built. This eliminated a flicker problem that occurred when lines were built directly into Memo1. One more interesting problem that I ran into and which might save some time for you in the future. When a control is aligned to the bottom of the form (like the TStatictext control in this case), and the form is resized to a smaller height, the control is placed below any existing controls. Adjusting the sizes in the OnResize exit is too late to prevent this problem. The solution is to use the OnCanResize exit to predict where the bottom aligned control will be and readjust the size and tops of the other controls in advance of the actual resize operation..
  4. Lajos Juhász

    How to set TBytes array to the file size ?

    You can take a look at http://delphiforfun.org/programs/utilities/hexview.htm.
  5. Lajos Juhász

    How to set TBytes array to the file size ?

    The file doesn't contains UTF-16LE text. You should check for the encoding of the file.
  6. Lajos Juhász

    How to set TBytes array to the file size ?

    In that case load it directly to the field you're going to use to store it in the database.
  7. Lajos Juhász

    How to set TBytes array to the file size ?

    If it's a textfile you can use memo.lines.loadfromfile or read it using TFileStream. For example: var f: TFileStream; buff: TBytes; begin f:=TfileStream.Create('d:\temp\test.txt', fmOpenRead+fmShareDenyNone); try SetLength(buff, f.Size); f.ReadBuffer(buff, f.Size); memo1.lines.text:=TEncoding.ANSI.GetString(buff); finally f.Free; end; end;
  8. Lajos Juhász

    How to set TBytes array to the file size ?

    Why are you doing this? You are allocating 33 bytes and in the next line assign the variable to a new array that is returned by TBinaryReader.ReadBytes.
  9. Lajos Juhász

    How to set TBytes array to the file size ?

    Why do you think that you have to convert NativeInt to Integer?
  10. Lajos Juhász

    Opinions about Pascal vs C/C++ IDE

    You mean something like this? https://blogs.embarcadero.com/start-building-apps-for-single-board-computers-with-delphi-or-c-builder-now/ I didn't watched it as it is not my thing.
  11. Lajos Juhász

    TControlList - Jump to Selected

    I've tested with Delphi 10.4.2 1. A dirty trick would be first set the ItemIndex under the control you would like to select on the top: ControlList1.ItemIndex:=40+(ControlList1.Height div ControlList1.ItemHeight); ControlList1.ItemIndex:=40; 2. OnItemClicked is fired when the itemIndex changes (both from code or user navigation).
  12. Lajos Juhász

    TTitleBarPanel and System/Custom Buttons

    For me it was also hard to set it up correctly for the first time. Unfortunately even in Delphi 11 it has some drawing issues RSP-36291.
  13. Lajos Juhász

    TTitleBarPanel and System/Custom Buttons

    This is on Delphi 10.4.2. CustomTitleBar.zip
  14. Lajos Juhász

    TTitleBarPanel and System/Custom Buttons

    Did you set the required properties for CustomTitleBar? For example: CustomTitleBar.Control = TitleBarPanel1 CustomTitleBar.Enabled = True CustomTitleBar.SystemColors = False CustomTitleBar.SystemButtons = False CustomTitleBar.BackgroundColor = clRed CustomTitleBar.ForegroundColor = 65793 CustomTitleBar.InactiveBackgroundColor = clWhite CustomTitleBar.InactiveForegroundColor = 10066329 CustomTitleBar.ButtonForegroundColor = 65793 CustomTitleBar.ButtonBackgroundColor = clRed CustomTitleBar.ButtonHoverForegroundColor = 65793 CustomTitleBar.ButtonHoverBackgroundColor = 16053492 CustomTitleBar.ButtonPressedForegroundColor = 65793 CustomTitleBar.ButtonPressedBackgroundColor = 15395562 CustomTitleBar.ButtonInactiveForegroundColor = 10066329 CustomTitleBar.ButtonInactiveBackgroundColor = clWhite
  15. Lajos Juhász

    tImageCollection in COM DLL - EXE needs manifest ???

    You mean this reference at https://docwiki.embarcadero.com/Libraries/Sydney/en/Vcl.Controls.TImageList: Note: Image lists depend on Comctl32.dll. If the system does not have the latest version installed, there may be problems getting images to appear.
  16. Lajos Juhász

    Mouse busy in IDE

    You can try to turn off the LSP.
  17. Most probably the packages are not on the path?
  18. Lajos Juhász

    Delphi 11, migrate or wait

    Here are RSP-s for the debugger: https://quality.embarcadero.com/browse/RSP-29768 https://quality.embarcadero.com/browse/RSP-36155 https://quality.embarcadero.com/browse/RSP-36520 https://quality.embarcadero.com/browse/RSP-36611 Sometimes I do get similair to this in Delphi 11: https://quality.embarcadero.com/browse/RSP-33299
  19. Lajos Juhász

    Using Resource in Email

    I doubt this will work, you've to include the picture into the e-mail, I don't know any e-mail client that would search the HDD for an e-mail attachment. You should check out: https://www.indyproject.org/2005/08/17/html-messages/ and https://www.indyproject.org/2008/01/16/new-html-message-builder-class/
  20. Lajos Juhász

    Delphi 11, migrate or wait

    You should learn how to use a search engine. https://www.embarcadero.com/app-development-tools-store/delphi
  21. Lajos Juhász

    Bookmarks dead?

    Feature Matrix: IDE productivity tool: Bookmarks*, which extends the IDE’s previous marking of locations in the code editor. * Available for download in the GetIt Package Manager (not for Community Edition)
  22. Lajos Juhász

    Delphi 11, migrate or wait

    Most probably. Unfortunately Delphi 10.4 debugger doesn't have any issue to access the property :(.
  23. Lajos Juhász

    Delphi 11, migrate or wait

    Of course for this I cannot create a test case, but it's in a real code and all references are valid: PPodsetnik.fQuery.Connection:=PDatabase; Now we would expect that PPodsetnik.fQery.Connection = PDatabase:
  24. Only on Apple hardware is legal. Is it illegal to run Hackintosh? According to Apple, Hackintosh computers are illegal, per the Digital Millennium Copyright Act. In addition, creating a Hackintosh computer violates Apple's end-user license agreement (EULA) for any operating system in the OS X family.
  25. Lajos Juhász

    ADS to MySQL

    From Delphi XE4 Embarcadero has a command line tool refind.exe to migrate components and properties (https://docwiki.embarcadero.com/RADStudio/Sydney/en/ReFind.exe,_the_Search_and_Replace_Utility_Using_Perl_RegEx_Expressions).
×