Jump to content

David Heffernan

Members
  • Content Count

    3781
  • Joined

  • Last visited

  • Days Won

    188

Posts posted by David Heffernan


  1. 23 minutes ago, Paul H said:

    Thanks David - I was hoping to find something with H-M-S support including setting / getting in decimals the way you can with TTime. It is probably no more than a couple of hours work to do something basic with a record helper, I just didn't want to duplicate something that already exists.

    I mean you didn't say any of this in your original post. Clearly you knew what your requirements were, but we can't read your kind! 


  2. It depends a bit on what your goals are. But if you want to test equality then you need to put the expected value into a single. That's hard to do in a compiler because delphi literal syntax doesn't allow to specify the type of a floating point literal. You could declare a typed constant of single type and compare against that. 


  3. 19 hours ago, jesu said:

    Thanks for all the suggestions. I have the feeling that VCL should somehow protect events that can recreate controls. Something like 

     

    
    if Creating then ForceQueue incompatible operations

     

    Before reaching this conclusion, does there exist a clear diagnosis of the problem. That hasn't been shown here yet, so I'd want to understand the problem before trying to solve it. 


  4. 1 hour ago, Typer2 said:

    It’s generally not advisable to change the font of a form or visual control directly from within an event handler like OnClick, especially for controls that are part of the form itself. Internally, setting Font.Name or Font.Size can lead to a call to CreateWnd, which may cause issues if it's done while Windows messages are still being processed for the same control—resulting in access violations like the one you're seeing in COMCTL32.dll.

    This is incorrect. Changing font properties in an event handler is fine.


  5. 2 hours ago, DelphiUdIT said:

    It is not mine, I'm not a chemical tech. I only see the use of the "absolute" directive and ask if there is any issue (in assignement for example). By the way I have tested some uses case and i don't found any issue, it's like a normal array of records.

    Like I wrote, I had know that there are other methods, I was only curious about "absolute" used in array of records.

     

    Thank you all for your interest.

    It has nothing to do with assignment. It's pretty rare for absolute to be useful. Pretend it doesn't exists, and you'll get a long way. 

    • Thanks 1

  6. On 11/24/2023 at 6:43 AM, robertjohns said:

    but on my system TOSVersion.ToString returns Windows 10

    We've no idea what your system is. There are many versions of Delphi. We don't know what your app manifest is. These are both possibly relevant. 

    • Like 1

  7. Isn't this a well documented file system for which there are multiple open source projects that you can use to support the documentation? 

     

    More generally, I'd advise you to put more effort into asking questions. Time spent describing what your problem is, what you already know, where you are blocked, etc. is effort you should spend if you want to get something in return. 


  8. 43 minutes ago, alogrep said:

    Thanks to all.

    No, the division by zero was an exampte (and a test I actually didi).

    It is all exceptions (that are not handled)

    The more critical one is when I set a table to an index name that does not esxist. 

    The app just exit, no wrnings.

    Doesn't sound like it's not that exceptions aren't handled. App exiting is entirely different. How about the details we asked for. 


  9. Or maybe floating point exceptions are masked so there is no exception. We can't see your code, or know what version you use. 


  10. 15 hours ago, Anders Melander said:

    That's a bit... unnuanced.

     

    I thought it was helpful. Even though the "problem" is pretty obscure, and I haven't encountered it myself, it's a point of data that might come in handy some day.

    My point is that it's behaviour that you don't ever need to know because the correct way to handle byte data is as, well, bytes and not text. So for sure there's an algorithm, but it's not one that anyone actually needs to know. 

    • Like 1
    • Thanks 1

  11. 2 hours ago, Roger Cigol said:

    Of course there ARE times when the use of ANSI strings makes sense. One example is when sending data to/from an external device down an RS232 port where the external device uses a protocol based on simple ANSI text. We have many real world cases such as this (eg Eurotherm temperature controllers). The key point that @David Heffernan makes is that you should choose your types carefully to closely (or exactly!) reflect your needs. Time spent thinking carefully about your type selection will save you time in the long run.....

    I mean, you work with strings and do TEncoding.ASCII.GetBytes

    • Like 1
×