Scripter IDE adds multiple events for same control


I think this is a bug. but who know I may be making a mistake.

To reproduce this please follow these steps:
1. Star the IDE sample provided with the component
2. In the default Project go to Unit 2's Form/Design view
3. Place a Button on the Form
4. Double Click the placed Button - this will create an empty procedure Button1Click(Sender: TObject);
5. In this empty procedure type - ShowMessage('this is testing' + #13 + ); [I know that this line is syntactically wrong and will generate error when we try to run the project, but keep it like that]
6. Go to Design view and again Double Click on the button
7. This will create another empty procedure Button1Click(Sender: TObject);
8. Try to run the project, it will give error
9. Solve the error
10. Try to run again and it gives this long error message :

So my concern is that this should not happen at all. The IDE should not create a new procedure ( as it does in step 7) but it should place the cursor in the previously created procedure (in step 4).

How to solve this problem?

Please guide me.



I just tried that, and agree it's odd behaviour.

I'd expect the same Button1Click procedure to be selected, or at worst (if the code can't be parsed properly because of errors) that a new procedure NOT be created.

You could always hit <Ctrl><F9> to compile right after finishing a procedure - to warn you that you have code errors before continuing.

This bug is a show stopper for me and I hope TMS solves is asap.



Unfortunately that's a limitation in the parser, where it cannot detect that an existing procedure declaration exists if the implementation code is not compiling. "Solving" this is not simple, actually it would require a reimplementation of the parser. 

If Ed's suggestion is ok, we could do that: raise an error saying that code is wrong and do not create a new procedure. But that would have to be an option because maybe other users would not like it - they might find it annoying to get error messages all the time.

Oh that is bad news for me.

But can you use the technique used by CnWizard (the Delphi IDE add-in) to parse the code irrespective of syntax error.

Just my thoughts.

As I am not much of a pro in this arena here are a few links that I would like to share:



Speaking as a customer...

I'm not sure I'd want to see a mature parser completely rewritten to clear up one issue.

Nor would I want to have my applications grow in size to accommodate extra code (effectively an extra parser) to test this condition.

I agree with Yogesh that this is annoying, but if you document it in the manual, then seeing an empty procedure appear when I know there should be an existing chunk of code is enough of a "flag" to me.

Seeing that empty procedure would be clear enough warning that I must have errors in my code...

That is a different parser, for a "different" language. TMS Scripter is "almost" pascal but has its own syntax. And don't forget it also has Basic syntax.