Jump to content

David Heffernan

Members
  • Content Count

    3710
  • Joined

  • Last visited

  • Days Won

    185

Everything posted by David Heffernan

  1. David Heffernan

    IfThen Oddity...

    IfThen as a function sucks big time. Why can't we have a conditional operator?
  2. I'm not convinced by this. But then I was primarily reacting to what you wrote.
  3. Looking at the update are you sure the function takes pointer to pointer to pointer to struct?
  4. We don't know what PDoubleArray1 is because the definition isn't here. However, you pass @Testdoublearray which is a pointer to pointer to record. But the native code expects pointer to struct. Clearly a mismatch. Given the various edits that have gone on between the real code and the code you posted, this could be wrong.
  5. True, but so what? If you want slim executables you wouldn't be using Delphi at all.
  6. David Heffernan

    Modal dialog closes before user input

    Reason is exactly as I described in my first comment. Down and up come in pairs. If one part of your program responds to down and another to up then you can have a down up pair invoking two distinct actions. Down invokes form show modal, up invokes closing that form. More prosaicly, if there is a common uniform way to do something in the system, your default should always be to follow that common uniform convention.
  7. David Heffernan

    Modal dialog closes before user input

    So why continue doing things in key up?
  8. David Heffernan

    Modal dialog closes before user input

    This sounds like you are papering over the problem.
  9. David Heffernan

    Modal dialog closes before user input

    Why are you doing anything in response to key up? Try using some respectable programs and see which of them perform actions on key up. Once you have done that, remove TDropDownDialog.ListBox1KeyUp and see how things behave.
  10. It sounded like you might be accessing an object after it has been destroyed which is obviously incorrect.
  11. David Heffernan

    Modal dialog closes before user input

    It's presumably the handling of KeyUp that sets the modal result. If the modal dialog is shown by mouse action, then happens on mouse up. But if shown by keyboard action, it is shown on key down. Then the matching key up is handled by the modal form which immediately closes.
  12. Pascal Analyser is wrong. Seems pointless to test with is TBoldObject and then cast with as. Once is tells you the cast is valid then go ahead and use an unsafe cast. Seems dubious to cast one object to be a class from an unrelated hierarchy. Don't know how that could be valid. Also, what is BoldObjectIsDeleted all about? Don't tell me this flag is set to true when the instance is destroyed.
  13. David Heffernan

    Function with 2 return values ?

    It goes from bad to worse!!
  14. David Heffernan

    Function with 2 return values ?

    We don't need any context to know that a fixed length array shouldn't be named a tuple.
  15. David Heffernan

    Function with 2 return values ?

    But it's a tuple too. My question was really for Stefan though.
  16. David Heffernan

    The best way to handle undo and redo.

    Very rare to find a scenario where this works well. The serialised state can be huge. And the asker here has a database to work with. You are going to serialise that in its entirety?
  17. David Heffernan

    Function with 2 return values ?

    OK. What name would you give this type array [0..2] of Double
  18. David Heffernan

    The best way to handle undo and redo.

    If there can be multiple users modifying the same database then this task becomes very challenging.
  19. David Heffernan

    Function with 2 return values ?

    That's a pair not a tuple
  20. David Heffernan

    AV in bds.exe

    Seems like a clear instruction to ignore future posts asking for help and instead laugh.
  21. David Heffernan

    Function with 2 return values ?

    Whilst you can, this doesn't feel like a great idea. It's one thing returning a tuple in a language like Python with support for unpacking. But a Delphi dynamic array should be used for arrays, things where each item is a different value of the same thing. That's not the case here. They are two distinct things. Use a record, or two out params.
  22. David Heffernan

    Converting a very long text to concatenated strings?

    This is why programmers learn to use scripting languages
  23. David Heffernan

    String on heap?

    That's clear from the code but we don't know what it's life time is. On the face of it, exactly as you say, TList<string> or TStringList would be much more suitable. But my reticence is that there are lots of unknowns.
  24. David Heffernan

    String on heap?

    What is sublist and what is FHintCell. It's all just guesswork. But having pointer to pointer to character array feels odd to me.
  25. David Heffernan

    String on heap?

    It looks a bit odd but because we don't know for sure what all of the types and objects are, and your extracted code has arguments that aren't used, I don't think it's easy to offer specific advice. However, it's hard to imagine a scenario where this code would be the best way to do anything.
×