Jump to content

JonRobertson

Members
  • Content Count

    171
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by JonRobertson

  1. JonRobertson

    VTK in DelphiVCL or DelphiFMX

    I have not heard of VTK and decided to take a peak. The documentation references examples using MFC and C++ Builder. However, the Win32 folder is no longer present in the Examples\GUI folder in their git repo. Searching the history of the repo, the C++ Builder examples were removed five years ago. I suspect getting support for using VTK in Delphi will be challenging, since the group stopped supporting C++ Builder years ago. That said, the old code is available via git history. For example, vtkBorlandRenderWindow.cpp. This snippet is from GetRenderWindow: // Stuff the renderwindow into our window FRenderWindow = vtkWin32OpenGLRenderWindow::New(); FRenderWindow->AddObserver( vtkCommand::AbortCheckEvent, FAbortCallback); FRenderWindow->SetParentId(Parent->Handle); Without a deep dive into the source, it appears VTK is using OpenGL for rendering and setting the OpenGL's window parent to a form. If I wanted to use VTK from Delphi, I would attempt: Use a supported open source C++ compiler to build the C++ source to either OBJ or LIB. There are multiple OBJ file formats. Delphi can link with OMF86 or COFF for 32-bit and ELF or COFF for 64-bit. See Link object file (Delphi) for more details. Translate the VTK headers to Pascal, which will be a challenge. From what little I have read, VTK appears to use features only available in newer versions of C++. There are some open source projects for converting headers, although they may not be able to convert the VTK headers. The second one specifically does not convert C++ headers. I included it because it uses libclang, which I suspect would provide a better translation for the "pure C" portions of headers. https://github.com/yunkot/HeaderParser https://github.com/neslib/Chet There are others. Search engines are your friends. ;) Well, most of the time. Another alternative is Python4Delphi, since VTK can be used from Python and appears to actively support use from Python. An advantage of this approach is the ability to "prototype" using standalone Python and then incorporate into a Delphi app via Python4Delphi. You have likely seen Pyscripter's posts in this forum. https://github.com/pyscripter/python4delphi
  2. JonRobertson

    What new features would you like to see in Delphi 13?

    I have heard or read many "justifications" for dismissing Delphi, but never that one. That said, DevExpress does have excellent components. I currently do not have the privilege of a license for any. Thank you for pointing out TdxLayoutControl , along with the video. I need to spend a little time to put together a proposal, I suppose, for my managers.
  3. JonRobertson

    Print TDBGrid

    I found FortesReport Community Edition on GitHub. The only documentation that I saw is in the source code and is in Portuguese. Or you could roll-your-own. There is some example code in this StackOverflow answer: https://stackoverflow.com/questions/7496813/print-a-tdbgrid/7500147#7500147
  4. If you are referring to persistent fields added via the Field Editor IDE window, the compiler will only complain if you update the field list after you update a query. If the query is changed and no longer returns one of the persistent fields, or returns a different data type for a persistent field, the code will still compile. Those "errors in dependent code" will not occur until run-time.
  5. JonRobertson

    MyDAC : Unknown column error

    The error "42S22 Unknown column" is not coming from the Delphi compiler, MyDAC, or the underlying TDataSet. It is coming from MySQL. From an online search, the error means that the field specified (FILEVERSION) in the field list of the SQL statement is not a column in the table. https://sebhastian.com/mysql-unknown-column-field-list/ When you call MyTable.Open, MyDAC is generating a SELECT statement based on the fields that you have added to your MyTable component. That SELECT statement has FILEVERSION in its field list. When executed by MySQL, the unknown column error occurs. I don't know if the following will work with TMyTable, but it might since TMyTable has TDataSet as an ancestor. Drop another TMyTable component on the form or datamodule. Set its properties to the same connection, database, and table as your current TMyTable component. Double-click on the new TMyTable component. If a fields window appears, right-click it and select Add Fields (or press Ctrl-A). When the Add Fields dialog appears, is FILEVERSION in the list? Using the debugger, ShowMessage, or logging, verify at run-time that the Connection and Database properties on your MyTable component are set to the expected values.
  6. JonRobertson

    Delphi Report Builder - Failed to export report on second attempt

    Is the report's pipeline a TppDBPipeline? If so, add a BeforePrint event handler to the TppReport component. In the event handler, call Dataset.First on the master/primary dataset used by the report. I do not have 22.04 available to test whether that is an issue. With 22.03, the dataset is Eof after the report is exported and attempting to generate or export the same report a second time results in an empty report. I would expect you would have seen some dialog informing you of an Access Violation before you tried to debug, unless there is code in your unit that is "eating" exceptions (an empty except/end block). Looking at RequestPage in 22.03, my first thought is that a pipeline, datasource, or dataset is being destroyed before the TppReport component is destroyed. In the unit containing the line CustomReport.PrintReport, is there any code that calls Free to destroy an object?
  7. JonRobertson

    Delphi and "Use only memory safe languages"

    Or US-CERT advisories from DHS. The advisory below may be 9 years old, but the Delphi language/RTL/VCL is as memory safe today as it was then. Possibly less safe. https://www.coresecurity.com/core-labs/advisories/delphi-and-c-builder-vcl-library-heap-buffer-overflow
  8. JonRobertson

    Class Arial not found when using PowerPDF

    I installed PowerPDF in Delphi 12 from GetIt Package Manager. Delphi 12 locked up on me due to LSP not responding. I killed that, Delphi 12 closed, and I went to try again. When I opened Delphi 12 again, the PowerPDF components were installed (despite the earlier lockup). I dropped a PReport on a form, followed by a PRPage, and the IDE showed the same "Class Arial not found" message that you have. I opened PowerPDFDR.dproj, opened PReport.pas from the Project Manager, and added PdfFonts to the uses clause (as suggested above). "Build" PowerPDFDR,dproj, "Build" PowerPDFDD.dproj, "Install" PowerPDFDD. I am now able to drop a PRPage on a form without error.
  9. JonRobertson

    Class Arial not found when using PowerPDF

    I am not sure what you are comparing. PDFFonts.pas on github does not have different versions of the source units by Delphi version. There is only one PDFFonts.pas. SysUtils not being in the uses clause of PDFFonts.pas would not cause the issue that you are seeing. If SysUtils is needed by PDFFonts, a compile error would occur when building the component package or compiling any unit that references PDFFonts. It is also possible that SysUtils was moved from the interface uses clause to implementation, or vice-versa.
  10. JonRobertson

    Class Arial not found when using PowerPDF

    Open PReport.pas and add PDFFonts to its uses clause. I'd suggest after PdfImages: PdfImages, PdfFonts {$IFDEF USE_JPFONTS} Close PReport.pas. Open the DelphiPowerPDF group project and do Build All. If you don't have the group project, build PowerPDFDR followed by PowerPDFDD. (Building PowerPDFDD should not be required, but I always build run-time followed by design-time when rebuilding packages.) Now go back to your project and see if you can add a TPrPage without getting the exception.
  11. JonRobertson

    Class Arial not found when using PowerPDF

    Actually, that would only solve a run-time exception. If the exception is occurring in the designer, then the code that registers the components in the IDE is not registering the PDF font classes.
  12. JonRobertson

    Class Arial not found when using PowerPDF

    Windows fonts are not represented as individual classes in the Delphi VCL. This error is occurring because PowerPDF is trying to create an Arial class implemented by PowerPDF. The actual class name is TPdfArial. It is registered in PdfFonts.pas. My guess is the design-time support in PowerPDF is lacking and that the unit PdfFonts is not added to the uses clause when you drop a TPrReport on it. (I do not have PowerPDF installed to test.) If PdfFonts is not in your uses clause, add it and then try adding/dropping a TPrPage on the form.
  13. JonRobertson

    TPngImage help needed for vague docs

    The Graphic property does not represent the "type of graphic". Think of it more as a helper class that is capable of loading multiple graphic formats. The only "conversion" is unpacking the image file format, such as color depth, color map or palette, compression, etc, to a Windows Bitmap GDI object. Once an image is loaded, SaveToFile or SaveToStream may be used to write the image to a different format. Yes. If you look at the source for TPicture.LoadFromFile, you will see that it internally uses TGraphic to load an image. Looking at the source code is an excellent way to find answers, particularly if the documentation seems lacking or confusing. They are used the same way. Depending on the file type you have loaded the required object is created. To expand a little, loading an image only creates one instance of a graphic class. Bitmaps, icons, metafiles, and WIC images are not the same type of image. Try loading a TImage with a PNG (Image1.Picture.LoadFromFile('image.png')) and using the Icon property to save it as an icon (Image1.Picture.Icon.SaveToFile('image.ico')). The exception "Icon image is not valid" will be raised. However, using Picture.SaveToFile('image1.ico') does work, at least in the test that I did. Random flounder is an excellent way to learn. Create a new VCL project, throw a TImage on the form, and try various things to see what works and what doesn't. Take some time to look at the underlying source code. Start with Vcl.Graphics.pas for the foundation, then look at the Vcl.Imaging units, such as GIFImg.pas, JPEG.pas, and PNGImage.pas. That is what I did while writing this message.
  14. JonRobertson

    TPngImage help needed for vague docs

    Once you add pngimage to the uses clause of any unit, the TPNGImage class is registered with TPicture, which enables your application to load and save PNG images. This is done in the initialization section of pngimage.pas (TPicture.RegisterFileFormat('PNG', 'Portable Network Graphics', TPngImage);). This provides PNG support to any class that uses TPicture to load or save impages, for example: TImage.Picture.LoadFromFile. If you want more control over the image itself, then declare and use an instance of TPNGImage and the provided methods and properties to load, save, or modify the PNG image as desired.
  15. JonRobertson

    Docking Example

    I found a demo project at https://github.com/Walibeiro/DockDemo. And a 9 page article that Brian Long wrote, titled Drag & Dock, published in issue 63 (November 2000) of The Delphi Magazine. I did not find anything more recent. I don't recall any significant changes to docking in the Delphi VCL. It has also been 9 years since I worked on an application with dockable forms.
  16. JonRobertson

    What new features would you like to see in Delphi 13?

    The Delphi compiler is also a single pass compiler, unlike C/C++. Being a single pass compiler is one of the reasons that Delphi builds projects much faster than a similar C++ project. I would expect changing Delphi to support multi-pass compiling would be a huge task with few benefits. But I don't know much about writing a compiler.
  17. It may very by Delphi version. $(OUTPUTFILENAME) worked for me in Delphi 11.3.
  18. You could try a pre-build event as a workaround: CMD /C DEL $(OUTPUTFILENAME) If your output path or filename has spaces, try CMD /C DEL "$(OUTPUTFILENAME)"
  19. JonRobertson

    A native VCL, and not Windows-based, TComboBox control.

    As does the Delphi debugger.
  20. Or build the desired applications using C++ Builder?
  21. JonRobertson

    What new features would you like to see in Delphi 13?

    You don't "set" it. You launch it. Click the Windows Start Button and either expand the Embarcadero Delphi group, or type "Delphi" or "DPI" or "Unaware". One of those should reveal an icon for Delphi (DPI Unaware). If you launch BDS.exe by another method, add /highdpi:unaware as a command-line parameter.
  22. JonRobertson

    A native VCL, and not Windows-based, TComboBox control.

    Perhaps it was a request (in Delphi 13) for a new VCL combo box control that is not a subclass of the Win32API COMBOBOX class.
  23. JonRobertson

    What new features would you like to see in Delphi 13?

    I recently came across a company online developing AI "clones", and decided to ask an "Abraham Lincoln clone" the question "Why do you believe you were assassinated?" After giving a three or four paragraph response that I would expect from documented history, the AI then asked me what circumstances led to my assassination. That isn't artificial intelligence. That is a complete lack of intelligence.
  24. JonRobertson

    What new features would you like to see in Delphi 13?

    Yep, I fought that headache even as a solo developer on a project. My dev machine is a laptop. The laptop's display has a different recommended scaling than the monitors attached to my docking station at the office. I would get so frustrated during commits because I only commit intentional or needed changes. I do not want commits littered with changes to Left/Top/etc due to the form designer running at a different scale/dpi. All of that headache thankfully went away after I discovered DPI Unaware mode.
  25. JonRobertson

    What new features would you like to see in Delphi 13?

    Genuine question on HighDPI. So far, working in DPI Unaware mode works well for me. As long as the run-time handles scaling "correctly". Since switching to DPI Unaware mode, I have not needed to write (or borrow) workarounds for HighDPI issues. Are there scenarios where designing in HighDPI would be beneficial? Just to improve the development experience or to improve the user's experience when using the produced app?
×