Martin Liddle 1 Posted Thursday at 05:41 PM I have been using a modification of TSpinEdit which I found somewhere on the Internet years ago. It has worked fine with all the recent Delphi versions but I can't get it to work with Delphi 12.1. It compiles but generates an exception when invoked. The code is: unit SpinEditEx; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Spin; type TSpinEditEx = class(TSpinEdit) private FOnUpClick : TNotifyEvent; FOnDownClick : TNotifyEvent; protected procedure UpClick (Sender: TObject); OverRide; procedure DownClick (Sender: TObject); OverRide; public { Public declarations } published property OnDownClick : TNotifyEvent read FOnDownClick write FOnDownClick; property OnUpClick : TNotifyEvent read FOnUpClick write FOnUpClick; { Published declarations } end; procedure Register; implementation procedure TSpinEditEx.UpClick (Sender: TObject); Begin Inherited; If Assigned(FOnUpClick) then FOnUpClick(Self); end; procedure TSpinEditEx.DownClick (Sender: TObject); begin Inherited; If Assigned(FOnDownClick) then FOnDownClick(Self); end; procedure Register; begin RegisterComponents('Samples', [TSpinEditEx]); end; end. Any thoughts on what I am doing wrong? Share this post Link to post
Anders Melander 1929 Posted Thursday at 11:42 PM 5 hours ago, Martin Liddle said: It compiles but generates an exception when invoked. What do you mean by "when invoked"? When you click on the buttons? The code looks okay to me (apart from the funky casing) so the problem is probably in your application code. It should be a fairly easy to determine the source of the problem if you run your application in the debugger. If you don't know how to do that then it's about time you learn. Share this post Link to post
limelect 51 Posted Friday at 09:47 AM @Anders Melander 9 hours ago, Anders Melander said: It should be a fairly easy to determine the source of the problem if you run your application in the debugger. If you don't know how to do that then it's about time you learn. Why are you not polite? and besides the guy says he works for years Sorry it bothers me Share this post Link to post
Anders Melander 1929 Posted Friday at 01:25 PM 3 hours ago, limelect said: Why are you not polite? and besides the guy says he works for years Sorry it bothers me That's okay. I don't mind critique. I don't think I was being impolite; I was direct. I assumed that the OP was a hobby programmer (or not a professional) since: He needed to ask the question at all. He used 24 years old code copied verbatim from experts-exchange. Code that anyone with a bit of experience should be able to write on their own. He didn't provide any details about the exception such as where it occurred, call stack, etc. which to me shows that he might be able to read code but doesn't understand debugging. Hence the suggestion that he learns how to debug. Next step would be to explain how to debug. 3 Share this post Link to post
Anders Melander 1929 Posted Friday at 04:20 PM (edited) 2 hours ago, Anders Melander said: I don't think I was being impolite; I was direct. FWIW, my wife who speaks "human" tells me that my directness was indeed impolite. So sorry, I guess. Edited Friday at 04:20 PM by Anders Melander 1 4 Share this post Link to post
Softacom | Company 7 Posted Monday at 08:48 AM We checked your code on Delphi 12.1 Patch 1 and all works fine. Something wrong with dcu, dcp, bpl or your project. Need minimal reproducible example to work around this problem. Share this post Link to post