Hi Greg
"Not sure what you mean when you say the call to the statement "thisform.command1.click" "
I mean't I am not sure if "thisform.command1.click" or similar expression will work if writen inside
an external procedure because the procedure is supposed not to "understand" what "thisform" means.
e.g: what is thisform if I am not inside the form anymore ?
Thanks
Moises
>>It would be very useful because when you write inside a procedure it will not work,
>>if inside the procedure there are lines as thisform.command1.click, etc.
>
>Not sure what you mean when you say the call to the statement "thisform.command1.click" will not work when called. You are correct that the "click" event is not called when you execute that statement; but the code in the method "click" that you enter will be executed when you call the statement.
>
>I know that some say that you should never put code in the the event methods -- but then if this is followed to the extreme then there would never be any code there... So what is the difference in the two different calls - the first with the code embedded in the click method:
>
>
>PROCEDURE Click
>WAIT WINDOW "Some code lines" NOWAIT
>ENDPROC
>
>
>The second has a call to an external procedure:
>
>
>FUNCTION Click
>DO CalledByClick
>ENDFUNC
>
>
>
>
>PROCEDURE CalledByClick
>WAIT WINDOW "Some code lines" NOWAIT
>ENDPROC
>
>
>I do not see any difference in the above except that there is another calling layer in the second. I routinely place code into the event methods and then will call these directly if applicable. For instance, if I have a 'Save' buttton then I add the code to perform the save into the click method of this button. Then if elsewhere I need to call the code to perform the save operation, then I will call "thisform.cmdSave.Click()".