Ideally you should only have one line of code in click(), this.onclick(). This code should be the same, no matter what kind of control you use. In the custom onclick() method you put whatever code you want to run. To make this work, you can't use the baseclasses, you must use subclassed classes where this method is added. In your case the keypress() will call _searchcmd.onclick() which then holds the code you want to run, both when you click the button and when you press Enter. Or even better, the actual code is in a form method, called from both onclick() and keypress().
>There appears to be a difference in physically clicking a button with the mouse, and doing it programmatically, as in thisform.thatbutton.click. Can anyone please explain this to me?
>
>I have a textbox that a search string is typed into. To make it more convenient for the user, so they don't have to actually use the mouse, I have the following in the KeyPress method:
>
>IF nKeyCode=13
> thisform._searchcmd.Click
>ENDIF
>
>
>The code in thisform._searchcmd.click is accessed, and run, but the cursor holding the SQL Select(ed) data is empty. Physically click the _searchcmd button, and the data is there...
>
>Thanks.