>Bill,
>
>You can't have your cake and eat it too.
>
>If there's no reuse anyway why do you worry about keeping it all in just one place?
>
>Call DoMyThing() from the button click. DoMyThing.prg will contain all the sub-procs that you want. Then you effectively have all of the code in one place, and it's called from just one place.
>
>Barring that just usurp several methods of the button, you can stash code in methods like Drag, OleDrag etc. Then you can have the really intuitive (*LOL*) Click code like:
>
>
with this
> .Drag()
> .OleDrag()
>endwith
>
>>It's a fairly complex procedure that could really use some sub-programs. The entire code is about 200 lines long and logically can be broken into about 4 different sub-programs.
Hi Hilmar,
This thread and the other one about the .h file definitions being used only once gave me an idea.
What do you think of this?
Define class _cmdBase as CommandButton
Procedure Click1
EndProc
Procedure Click2
EndProc
Procedure Click3
EndProc
Procedure Click4
EndProc
Enddefine
then inside the button:
button.Click()
#DEFINE get_window 'Click1'
#DEFINE check_status 'Click2'
#DEFINE change_status 'Click3'
with this
lo = .get_window(p1,p2)
.check_status(lo)
.change_status(lo)
endwith
button.Click1()
......
button.Click2()
......
button.Click3()
......
Do you think it would work?
Maybe even figure out a way to have properties hold the definitions, so I wouldn't even have to have the #DEFINE .... in the Click().
Maybe have the Error() trap for them.
Or maybe somehow have the project.build() create .h files for each button in the project and just #Include it in the Click().
Bill Morris