-
Content Count
2563 -
Joined
-
Last visited
-
Days Won
134
Everything posted by Anders Melander
-
And the only one that knows what it does left ages ago... So it's not even possible to test if the new implementation works the same as the old because nobody knows exactly what or why the old did. Yup. That's what I deal with. Every. Single. Day.
-
-
That's just nonsense. I've written plenty of applications in Delphi that applied the MVC or MVP patterns. True, there's no wizard that can, clickety-click, write your template code for you, but it's really not that hard to do yourself once you've decided how to apply the pattern. It makes no sense to insist that one tool should be good for all problems or that Delphi should support all patterns. There are patterns that work well in Delphi but which doesn't fit for example JavaScript. That doesn't mean there's something wrong with JS. It just means you need to use a different pattern.
-
Nothing is stopping you from doing DI. Why do you need that "in the box"? As for MVVM I'm not convinced Delphi should do it at all. Not every pattern fits every language.
-
The book has many (good) points. One of them is that you can't naively solve a deadline problem by throwing more manpower at it; Time=Work/Resources is a meaningless equation. I assume this is what you allude to. However it also points out that you can solve a 2000 man-hour job in less that 2000 hours by allocating more manpower if the job can be split into separate, largely independent, tasks. I think that applies here.
-
Sure, but how is that relevant? Are you saying that they have enough resources or that more resources will lead to more problems? I'm sure that they have plenty of problems besides resources but surely their ability to solve them isn't improved by this shortage?
-
I acknowledge that this is a point of personal preference and I'm not challenging yours but FWIW of all the applications that I happen to have running right now only one does not navigate in tab order: SQL Server Management Studio The remaining all navigate in tab order. Firefox Excel Adobe Acrobat SourceTree ThunderBird Windows PowerShell ISE Delphi
-
My guess is that you're keeping a reference to one of the outlook items but that doesn't explain why you get the same attachments when you create a new message. Try starting without Outlook running. When you do GetActiveOleObject('Outlook.Application') Outlook should start and when you do VarClear( Outlook ) it should terminate again. Use taskmanager or something like it to verify that the Outlook process has terminated. if everything else fails you could also just empty the Attachments collection after you have sent the message. Ie while (vMailItem.Attachments.Count > 0) do vMailItem.Attachments.Remove(0)
-
I think they are primarily meant to be used when you're working with COM. For non-COM interfaces I agree that there's little point. Let's say your inner object is itself a wrapper of an external COM object. In order to have the inner object aggregate the external object, using implements, the inner object must implement IUnknown but delegate it's methods to the containing object and this is where I can see a purpose for TAggregatedObject.
-
Okay but do you create a new mail item for each mail or do you reuse the first one you create?
-
You've answered the question yourself with your example: Use TAggregatedObject when the inner object is reference counted.
-
Please show us your code (minimal example). I'm mainly interested in how/when you create vMailItem.
-
You should probably read some literature on COM in general first. Then the documentation will make more sense: https://docs.microsoft.com/da-dk/windows/win32/com/containment-delegation https://docs.microsoft.com/da-dk/windows/win32/com/aggregation ...but maybe this can help: https://stackoverflow.com/questions/3483680/delphi-how-delegate-interface-implementation-to-child-object FWIW, without having a clue about what problem you are trying to solve, my bet is that you should just concentrate on TAggregatedObject. You very seldom need to deal with TContainedObject.
-
Drag and Drop Component Suite for Delphi 10.4 Sydney
Anders Melander replied to PeterPanettone's topic in VCL
Yes. That was what I meant. My brain was in Delphi 3 mode You fix it I have nothing to do with that fork. I just wrote the original code. I think that is a problem with Unix vs DOS line endings. I've seen that kind of problem when a file contains Unix line endings. One of the contributors probably has their Git client misconfigured. Or maybe it's your client. The client needs to do implicit LF->CR/LF conversion. -
One more memory leak and FastMM4
Anders Melander replied to Alberto Paganini's topic in RTL and Delphi Object Pascal
Yes I understood that. What I mean is that you need the other methods from TInterfacedObject to protect against early release. Notably: AfterConstruction and NewInstance. One step closer. This is why you should start with a minimal example so you can eliminate possible sources. Next try to just register the interface/implementation in Spring (without any of the supporting code) and instantiate an instance of IMainDMTEST. Make sure you release the instance before termination (like the unnecessary nilling in my example). You want to make sure Spring isn't holding on to a reference. I can see from your code that you mark IMainDMTEST as a singleton. I don't use Spring but my guess is that Spring holds a reference so it can return the same instance (i.e. singleton) if asked for it. Try with and without AsSingleton. -
One more memory leak and FastMM4
Anders Melander replied to Alberto Paganini's topic in RTL and Delphi Object Pascal
No. You need those too. They have a purpose. I think you need to start with a much simpler test case. Does it leak if you leave out all the Spring stuff and just do this: var Test: IMainDMTEST; begin Test:= TDMSimulation.Create(nil); Test := nil; end; -
Drag and Drop Component Suite for Delphi 10.4 Sydney
Anders Melander replied to PeterPanettone's topic in VCL
As far as I can tell they don't use a package suffix (hence the "103" in the package name) -
Drag and Drop Component Suite for Delphi 10.4 Sydney
Anders Melander replied to PeterPanettone's topic in VCL
I think I can count the FMX application I've made on one finger, so I have no expertise in that area, but if FMX controls on Windows have a Windows handle then it could be made to work. My guess is they do not. It could still be made to work without a Windows handle on individual controls but that would require a emulation layer between FMX and the DD components. Not something I have time to write at the moment. -
Drag and Drop Component Suite for Delphi 10.4 Sydney
Anders Melander replied to PeterPanettone's topic in VCL
Not tested but I think you need to: Open DragDropDR103R.dpk (the run-time package) Save as DragDropDR104S.dpk Compile Open dclDragDropDR103R (the design-time package) Remove DragDropDR103R from requires and add DragDropDR104S instead. Save as dclDragDropDR104S Compile and Install. Personally I would just get rid of the run time package (and the requires). -
One more memory leak and FastMM4
Anders Melander replied to Alberto Paganini's topic in RTL and Delphi Object Pascal
That implementation is a bit over-engineered because it tries to handle mixing interface and object references. All you need to do reimplement _AddRef and _Release and stick to referencing the datamodule by the interface. Use TInterfacedObject as an example. There was a thread here earlier this week on that exact topic but apparently it was deleted or maybe got lost when the server went down. -
Close enough.
-
You are just repeating what you wrote in your OP. It's really very simple. Just abandon your assumption that commands entered on the command prompt are treated the same way as commands in a batch file; They are not. The behavior you are observing is as expected. For console applications both cmd and bat will start the process, wait for its termination and set errorlevel to the process exit code. For GUI applications bat will do the same as for console applications, but cmd will start the process without waiting for it to terminate. The value of errorlevel is irrelevant. All this has nothing to do with Delphi BTW.
-
Strange question. Because batch file execution isn't the same as command line execution. There are different ways to start a process. The command line uses one method, the batch file another.
-
Yes. A GUI application will be detached from the console when it starts. For example if you type "notepad.exe" on the command line and press enter, notepad is started and the command prompt immediately returns. Even if your application sets ExitCode this is communicated back to the console because the console just launches the application and doesn't wait for it to terminate. This is the same reason that GUI applications can't (reliably) write to the console.
-
F11 does not show the Object Inspector in the Form Designer
Anders Melander replied to PeterPanettone's topic in Delphi IDE and APIs
I see the same behavior in 10.3 and 10.4; Pressing F11 cycles focus: Designer -> OI -> Editor -> OI -> Designer etc. While this doesn't work like I would expect (to the point where I think it unusable) at least it's consistent. FWIW it's been like this since Delphi 4. From Delphi 1 to 3 you could toggle between OI and Designer with F11. The behavior changed when it became possible to dock the OI to the editor and I guess it changed again when the editor and designer merged. Good luck with that. There has been complaints about this behavior for as long as I can remember.