Recently, I was asked to automate a small routine that represented a series of data records and any two of the four potential buttons that the user can select after viewing the analysis of the record. The boss said that users see that the analysis was wasting time, since users invariably chose number one in the list of buttons, and he was ready to live with my guesses for everyone except the best of his users. So he wanted a new series of buttons to be added to offer the pen automatically, the pen in manual mode, and the Case Case pen. The last button launches the existing code. The second button will do almost nothing and just exit. First button? Well, that was rub.
What I decided to do was use a couple of flags, and then the automatic way to simply simulate the click of any sub-button is best based on analysis. The problem was that calling Button1Click (Sender) was not possible because the procedure that performed the Analysis was called RunAnalysis and was not bound to a specific object to pass TObject through. I ended up reorganizing the guts of the Button1Click method into Button1Pressed, and then called THAT from Button1Click. Thus, I was able to call Button1Pressed from RunAnalysis.
The missing path should have called Button1Click (Nil). I have not tried since I had a simple solution (thanks to Modelmaker, by the way). But my question is whether the reference to zero would work or whether it would cause a disaster. Can I call a higher function (by chance?) That had a sender ONLY have a sender object in a procedure call? How important is a Sender object if I do not use anything that is actually a LIST of sender?
System Information: Delphi 7 in the Win 7 programming environment for use in Windows XP.
Thanks in advance for any wisdom, GM
source share