Jump to content

Larry Hengen

Members
  • Content Count

    87
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by Larry Hengen


  1. 2 hours ago, Anders Melander said:

    one of the usual suspects will be happy to provide you with an alternative solution. 

    If I am among the suspects I would have to disappoint.  I agree that it is likely related to thread ownership of the string passed.  That is why in old code you often see the use of a record type or short strings allocated in the calling thread and freed in the receiving thread.  Like a flaming bag of dung thrown over a wall...up to the receiver to dispose of it.🤣

    • Like 2

  2. I suspect your problem is due to reentrancy.  The code is using Windows messages to update to the UI only in the main VCL thread.  This is a common old school approach prior to the use of TTHread.Synchronize().  I would venture the issue lies in the fact that Application.ProcessMessages is called in the message handler.  As such it will attempt to process any pending messages in the message queue.  When the load created by other threads is sufficient, there will be messages in the queue, and AVs will result as the stack variables will be overwritten.  Take out the Application.ProcessMessages I would bet the AVs disappear.

     

    Calling Application.ProcessMessages is common when the main VCL thread may be very busy, but you want the UI controls to update to reflect progress.  It is a CODE SMELL.  If you see it, remove it.  A background thread should be used for longer running tasks and these days there is no excuse for not using one because with the PPL, OTL or even just TThread it isn't that hard any more.  In this case someone who didn't understand how the program works must have added the call to Application.ProcessMessages or thought it might help because the method call to write the log was taking so long.  You might want to move the log writing to a background thread as well, and that would keep the entire processing headless, which is an excellent way to ensure it is testable with minimal dependencies.

     


  3. 1 hour ago, Lorenzo B said:

    I can also agree with you in thinking that it may depend on something in my code. I've thought about it several times, but I can't understand what it can be. Almost all of my programs are made up of a main program (EXE), a common package that is linked directly by the main program and "n" other packages, that are loaded dynamically when the program starts. So I suppose that if the problem exists, it must be looked for either in the main program or in the common package, because the other packages do not yet exist in the phase in which the debugger crashes (maybe???).
    Sorry I'm not clear what you mean when you say to disable "error insight" and "code insight" and increase the delay?!

    However the structure I use is the same as when I was working with Delphi 7, but with that version I have never had these problems!

    Go to Tools - Options - select the Editor Options - Code Insight treeview item (at least this is the path in Berlin).  You will then see the features I am referring to.


  4. I would suggest turning off features one at a time to try to isolate the issue.  It is very likely related to your code, but it doesn't mean the code is incorrect.  Cyclic references can can cause issues.  I would try  disabling error insight, and turn off code insight or increase the delay and see if that helps.


  5. It is really discouraging to see the excuse that we can't fix it because it might break someone else's code...again and again.  I would encourage the bug reporter to contest the "resolution" on such tickets and put comments I see here on those tickets.  Without push back, there will be no change and I don't think the decision was made at a very high level.  I bet @Marco wouldn't support that decision publicly.


  6. 20 hours ago, Anders Melander said:

    Are you asking if there's a way to have the Getter and Setter methods declared automatically from the property declaration in the interface declaration?

    Yes that is exactly what I am asking.  I too have traditionally used class completion on the class and then copied the Getter/Setters to the interface, but ideally the IDE limitations should not prevent you from working the way you wish too, it should facilitate most use cases.  You should not have to implement an interface on a class in order to define the interface.


  7. When re-factoring code so I can introduce an interface I need to have properties implemented on the interface for compatibility to the existing implementation, so I need setters and getters to be implemented.  I f I copy all the property declarations from the existing class and change the Field references to Get/Set methods, I would like to have the Delphi IDE generate the Get/Set methods the same way class completion does so for classes. Is there a way in the Delphi IDE to get Interface declarations "completed" IOW the method declarations generated in the interface?

     

    Here is some sample code to illustrate the issue:

      ICRSAMClient = interface(IInterface)
        ['{FF3CA485-A0CA-4ED6-8D70-9A757E8E9E0E}']
        //property Getters/Setters
        function GetCRSAMData :TCRSAMDataArray;
        procedure SetCRSAMData(Value: TCRSAMDataArray);
        function GetCRSAMDataCount :integer;
        procedure SetCRSAMDataCount(const Value: integer);
        function Q22Search(Param: TCRSAMSearchParam; Threshold, RowLimit: double): boolean;

        property UserId: string read GetUserID write SetUserID;                                       // User ID (authorization)
        property UserFirstName: string read GetUserFirstName write SetUserFirstName;                  // User First Name (authorization)
        property UserLastName: string read GetUserLastName write SetUserLastName;                     // User Last Name (authorization)
        property SendingApplication: string read GetSendingApplication write SetSendingApplication;   //
        property SendingFacility: string read GetSendingFacility write SetSendingFacility;            //
        property ProcessingID: string read GetProcessingID write SetProcessingID;                     //
        property Data: TCRSAMDataArray read GetCRSAMData write SetCRSAMData;                          // CRS returned data structure
        property DataCount: integer read GetCRSAMDataCount write SetCRSAMDataCount;                   // Data structure object count
      end;


  8. I downloaded and tried a development version and it was as advertised.  I think I had to change 1 line of code and voila....a browser based version.  That said, if you do some things like host an ActiveX, or WPF control in your app then it's not quite so straightforward.  For a smaller application it is certainly a solution that beats redevelopment as a  web app.  I don't think hosting a large app is a good long term solution due to the server resources required, but it's certainly worth some investigation.

    • Like 1

  9. 3 hours ago, ertank said:

    I have a friend using ReportBuilder and for export purposes he uses Gnostice PDF Toolkit because ReportBuilder is not capable of building quality and glitch free PDF, PNG, etc files.

    Gnostice has support for ReportBuilder.

    Thanks for the feedback.  I would probably opt for Gnostice PDF Toolkit rather than using ReportBuilder with Gnostice's ppDevice implementations because if there is any issue one vendor might just point the finger at the other and it makes it more difficult to isolate the cause.


  10. @Geowink,

     

    I actually bought RAVE at BorCon back in the day, but abandoned using it around the time they were no longer bundled with Delphi and support dried up.  I didn't know they were still in business, but that experience kind of soured me on them.  I was looking at Gnostice PDF Toolkit as a potential solution.

     

    @Attila Kovacs

     

    Interesting component suite.I can see that being a great solution for server side web projects.


  11. I am currently not using a reporting tool but I have used ReportBuilder in the past.  It is one of my more favorite report writing tools, but I was not aware that it would provide the functionality I desire for this use case.  Do you use it to print an image of the chart?  If that is the case then would you not still have to determine the image resolution to use, and where to segment it so it would fit on a page with the legend?


  12. Anyone ever printed charts that are segmented to fit each page with a legend?  Client wants PDF output with multiple graphs vertically on the page with a user defined horizontal extent (ie: 50 metres) of each graph appearing on each page with a legend beside it.  Not quite the same problem as just printing an oversize image.  Any recommendations on approach or tools for Delphi?


  13. 23 hours ago, John Kouraklis said:

    For projects with local database, I would go for sqlite as it doesn't require a DB server.

    I would only use SQLLite for smaller mobile projects.  I have found that Firebird 3.04 performance is much better than SQLLite on my laptop and it has a richer set of data types and more features.

    • Like 2

  14. 6 hours ago, PeterPanettone said:

    Normally, an app in its About dialog has an [Update/Upgrade] button which does everything automatically (maybe with a few option checkboxes). At least, this is standard UI.

     

    Why does the Delphi IDE not have this standard UI? 

     

    Who is responsible for the design of the Delphi IDE UI?

    The answers to your questions would be 'ask Embarcadero', and 'Embarcadero'.  It is really pointless to ask such questions here.  I have advocated for an in-place upgrade mechanism for a long time now.  The response I received from Marco IIRC, is that it was under consideration but was a very complex issue to address because the product is so big and involves third party components.  There are lots of similar products that have AutoUpdate functionality so I don't think this is an insurmountable problem, but EMBT has other more important issues to deal with such as keeping the frameworks and compiler tool chains up to date with an accelerating pace of change on all the supported platforms.  They didn't have time to bring FMX to Linux, so they acquired it from KSDev. As with any 25+ year old product, there is also technical debt to address.


  15. 1 hour ago, PeterBelow said:

    set the form borderstyle to bsNone, so it has no caption bar.

    Thanks for the answer.  It's always nice to know why.  Actually the Caption bar is one of the things I liked about using embedded forms, that and the OnCreate/OnClose events.  I have switched things to use TFrame descendants, which works reasonably well, but I had to introduce my own caption bar and deal with the lack of the events I mentioned.


  16. Thanks all for the replies!

     

    I tried it out and it certainly beats copy/pasting from the interface.  This feature has been unknown to me until now.  I wish I had asked earlier.  Is there a similar way to implement an event handler when you don't know what the declaration is?  I usually end up drilling into, or using GExperts to search through, the vendor source code (if I have it).  Sometimes I have to write down the handler definition given by code insight, and then code the handler manually.  I assume there is probably a better way?


  17. Please forgive the question if it's seems obvious.  I have always Implemented an interface in a new class the hard way in Delphi by copying the interface members from the interface into the class and using class completion to generate the methods.  Is there a way to do so in the Delphi IDE without such a manual brute force technique?  I don't see anything in the Refactor menu and invoking Class Completion on a class with an unimplemented interface does nothing.  Is this only possible through a third party IDE add-in like MMX? 

     

    I would think that in the age of interface based development, making it easy to define and implement interfaces would be a well supported use case within the IDE, so I am assuming I just don't know of it. It's a snap in Visual Studio.

×