To @toyvoy.
A few comments on the source code.
1. Get rid of global variables, this is generally a "bad" style. At least move them to the private section of the TForm1. If you later want to create a second instance of the form, you do not have to double the global variables.
2. The
word is not a very suitable name for variable. It hides the built-in type
word. So if you use the note above and add the letter F to the field name (common practice), you get FWord (maybe even better name FWords).
3. In FormPaint the try finally construct is used incorrectly (for some reason, the popular error). You must protect the resource
after its allocation. Those you need to do
Instance := TSomeClass.Create;
try
//Code with Instance
finally
Instance.Free;
end;
i.e. not transfer the initialization after a try. In your case, for example, if an exception occurs during the execution of the constructor, then call of Instance.Free will, at best case, cause a nested exception, but if in the Instance (garbage on the stack) will be the address of the real object (the main form, for example
) then you spent a lot of time to find an error in the program.
4. The InputWords procedure. If you protect a memory leak when creating an object, then the system resource (file) is all the more in need of protection, i.e. use try finally.
AssignFile(f, ...);
Reset(f);
try
// Use file
finally
CloseFile(f);
end;
5. Expression
if SomeBool = False then (or
if SomeBool = True then) look clumsy. It is better to use the natural
if not SomeBool then (or
if SomeBool then).
6. VisibleAll and InvisibleAll procedures better be merged into one like SetVisible(AVisible: Boolean), then inside you use Field.Visible: = AVisible (or := not AVisible), and call as SetVisible(True) or SetVisible(False).
7. For the case statement, it's better to place the operators below line of
constant value, so when debugging, you'll see which case was selected.
And returning to the original question: with name conflicts, you can specify the required procedure using the module name, that is, specify System.Reset.