JM> SR> I'm missing something, I think. Can't you just write your
ubroutine
> SR> and then put the call in the OnClick event?
JM>Yes, and that is what I did initially. However, it doesn't seem
>very practical in the long run (especially for a big program)
>because you have to make modifications, debug, etc. In this
>case, I had my subroutine ReadData called on FormCreate (I
>think) and then later I wanted to call another subroutine right
>after the call to ReadData. As far as I can tell, you can't do
>that in the OI. So I had to remove ReadData from the OI, double
>click to have it create a subroutine, and then add the call to
>ReadData and the other subroutine there.
JM>The point is that while this is not difficult to do, it seems
>that it is better to go ahead and double click to create the
>subroutine in the source code in the first place, so you can see
>the explicit call to your subroutine.
I guess I do it a bit differently. For Button1, I put all the routines
that need to be called when it's clicked into Button1Click. If I need
one routine or ten, they are all just called in Button1Click. If I
need to change Button1's behavior I just edit Button1Click, but it's
always just Button1Click. i.e.: The routine called by the OnClick
event is always the same, I just edit it to call different subroutines.
In the case you mention, I would create an OnCreate routine and have
it call the routine ReadData. Then it's a snap to change, plus it's a
bit more self-documenting and it lets me call ReadData elsewhere if
needed.
--- PCBoard (R) v15.3/M 5
---------------
* Origin: Riverdale, Ga (1:133/9024)
|