Hi Nikolaos,
Sorry for making you confused. Here I will try to describe what I have done what I want to do in detail.
I am trying to give user some suggestions when they try to input in some controls. I have written a function that can get the suggestions that I need to present to the user. add an event handler to the By executing this event handler, I can
Because there are more than one suggestions for user to select, the controls needs to allow user to select. So I thought that I can take advantage of lookup form of the controls. So I wrap the method I wrote as an event handler and add it to the OnLookup event of all controls that I want to modify (their types are among FormRealControl, FormStringControl, FormIntControl and FormInt64Control). At this point, each time I click the lookup button of a control, the event handler will be executed and the suggestion will be given. So the next step is to show the suggestions on the lookup tables of the control.
I found that all lookup forms extend the class "FormRun", so I use COC to hack into the init method of FormRun to add some buttons, each one of which represents a suggestion, on the form if it is displayed as a lookup table. This solutions works well as the following picture shows. The area in red rectangle is what I add to the original lookup form of the control.

However, this solutions only modified the lookup form rather than controls. So for the controls that originally performs a lookup form, it works well. If a control does not perform a lookup form, the button that I want will certainly not appear because there is no lookup form at all. So I thought that if I could let these controls perform an empty lookup tables, things will be done.
Now I can override the "lookup" method of a control that doesn't perform a lookup form manually to let it perform a lookup table. By doing this, the suggestions that I generate are able to be placed at the newly performed lookup form, as the following picture shows.

It is clear that by doing the same thing as above on every controls that doesn't perform a lookup form (this is what I called "hard code"), I can achieve my goal. However, as my solution is supposed to be adapted on many controls in different scenarios, I am not able to determine the number of the controls that would be modified. In fact, this number depends on different scenarios. So I have to do this dynamically at run time.
Sorry again for not describing things clearly.
Luca