David Heffernan 2366 Posted Thursday at 04:32 PM 1 hour ago, dormky said: Then please explain ? I delphi, I write to a variable that is then monitored to close the form. In Window, I call a function. Those two things are completely different. Imagine if you would read documentation. Like that for EndDialog. And imagine if the documentation for EndDialog said this: EndDialog does not destroy the dialog box immediately. Instead, it sets a flag and allows the dialog box procedure to return control to the system. The system checks the flag before attempting to retrieve the next message from the application queue. If the flag is set, the system ends the message loop, destroys the dialog box, and uses the value in nResult as the return value from the function that created the dialog box. So yeah, it's exactly the same as the Delphi mechanism. Because that's how modal dialog are implemented in Windows. 2 Share this post Link to post
dummzeuch 1542 Posted Thursday at 06:25 PM 2 hours ago, dormky said: There's a reason Delphi is a dead language Not that again! Just remove the f*ck*** call to Close and be done with it. 2 Share this post Link to post
Brandon Staggs 324 Posted Thursday at 06:38 PM (edited) 16 minutes ago, dummzeuch said: Not that again! Just remove the f*ck*** call to Close and be done with it. But, the language is dead because he doesn't have to call Close. If he removes the call to Close and suddenly everything works the way it was designed to, then the language may come back to life. Sounds dangerous. Edited Thursday at 06:45 PM by Brandon Staggs Share this post Link to post
dormky 3 Posted yesterday at 07:59 AM 15 hours ago, David Heffernan said: Imagine if you would read documentation. Like that for EndDialog. And imagine if the documentation for EndDialog said this: EndDialog does not destroy the dialog box immediately. Instead, it sets a flag and allows the dialog box procedure to return control to the system. The system checks the flag before attempting to retrieve the next message from the application queue. If the flag is set, the system ends the message loop, destroys the dialog box, and uses the value in nResult as the return value from the function that created the dialog box. So yeah, it's exactly the same as the Delphi mechanism. Because that's how modal dialog are implemented in Windows. Yes, but the difference is that the flag is internal. We do not have access to it, nor is it the same as the value returned by ShowModal call. Again, to close in Windows I call function. In Delphi I set a flag. Fundamentally different things. Share this post Link to post
Anders Melander 1852 Posted yesterday at 08:30 AM 25 minutes ago, dormky said: Again, to close in Windows I call function. In Delphi I set a flag. Fundamentally different things. Yes, yes, we see now. How could we have been so blind? Totally different things. Totally! Now, run along. 1 1 Share this post Link to post
Lajos Juhász 303 Posted yesterday at 10:46 AM 2 hours ago, Anders Melander said: Yes, yes, we see now. How could we have been so blind? Totally different things. Totally! Instead of running away from this terrible problem. Anders you should write a class helper to help to solve this gigantic bug in the design. I mean how can we live and use Delphi knowing that it has this very poorly design in the fundamental part of the VCL. Share this post Link to post
Anders Melander 1852 Posted yesterday at 11:00 AM Just now, Lajos Juhász said: Instead of running away from this terrible problem. Anders you should write a class helper to help to solve this gigantic bug in the design. I mean how can we live and use Delphi knowing that it has this very poorly design in the fundamental part of the VCL. I dunno. I think it's pointless. I mean, properties? Pfft! What's the point? Delphi is dead anyway and if there's one thing the past 30 years has shown it is that the design is flawed beyond repair but we were just too ignorant to notice. If only we had been told about this before. The shame is unbearable. 1 Share this post Link to post
dormky 3 Posted yesterday at 11:04 AM Hey, bad design doesn't mean it's not useful. I still use a car whose AC is less powerful then a fart lol. Share this post Link to post
Sherlock 668 Posted yesterday at 11:35 AM Luckily Delphi isn't the only IDE out there. Freedom of choice is a thing. Share this post Link to post
PeterBelow 246 Posted yesterday at 11:48 AM 23 hours ago, dormky said: Heavy disagree. A message/event driven environment should, you know, actually use events instead of mixing in state monitoring. The VCL has to work in the API environment that Windows provides. So aim your criticism at Microsoft ;). Share this post Link to post
David Heffernan 2366 Posted yesterday at 01:06 PM 5 hours ago, dormky said: Yes, but the difference is that the flag is internal. We do not have access to it, nor is it the same as the value returned by ShowModal call. Again, to close in Windows I call function. In Delphi I set a flag. Fundamentally different things. Windows API can't expose a flag directly so has to provide a function to set it. You are incapable of learning, no wonder this is so hard for you. Share this post Link to post
dummzeuch 1542 Posted yesterday at 01:35 PM 24 minutes ago, David Heffernan said: You are incapable of learning, no wonder this is so hard for you. OK, now we go into the domain of personal insults. Share this post Link to post
Sherlock 668 Posted yesterday at 01:52 PM Yeah, I feel the question has been answered. Everybody should now move on...nothing to see here. Share this post Link to post
David Schwartz 440 Posted 6 hours ago On 1/30/2025 at 5:20 AM, David Heffernan said: Wow. This is so wrong. That call to Close is definitely getting executed. Setting ModalResult doesn't raise an exception. Which would be the only way to avoid Close getting called. Setting ModalResult can be overridden, as well as Close, in some damned obscure ways. That's all I'm saying. But calling Close after setting ModalResult is completely unnecessary. And if setting ModalResult isn't closing the form, then tossing a call to Close in there may or may not work, or may not do what you expect. This is based on my experience. YMMV. Share this post Link to post
David Heffernan 2366 Posted 3 hours ago 2 hours ago, David Schwartz said: And if setting ModalResult isn't closing the form, then tossing a call to Close in there may or may not work, or may not do what you expect. This is based on my experience. YMMV. No, that call to Close should never be made. No ifs and buts. Stop guessing at how the system works. 2 hours ago, David Schwartz said: Setting ModalResult can be overridden Really, how ? Share this post Link to post