Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can You Set Breaks In Form's Code Like A Program's Code With Debugger

Status
Not open for further replies.

drosenkranz

Programmer
Sep 13, 2000
360
US
I know I can set control breaks in my "program" file's code segments using the VFP debugger. How do you set breaks in the code contained "within a form's controls"? Is this possible?
The 2nd mouse gets the cheese.
 
I am not sure I understood what you want to do.
I will assume that you want to suspend your program and start debuging and tracing. If so you can use
Code:
Acti wind command
Acti wind debug
SUSP
Anywhere you want in your code regardless it is PRG or control procedure.
Thanks
Walid
Engwam@Hotmail.com
 
The quickest way to find out about something like that is to .... just try it.


Don
dond@csrinc.com

 
I'm used to VB's debugger. You can place breakpoints anywhere in your project's code and you can run your project to that break and then see details. It allows you to <Break> your program while its running, change the code right there, and you can restart from where you left off too. Everything is done on the fly.

I know the VFP Debugger requires you to stop on errors and cancel the program. Then you have to go find the offending code and rerun the project all the way back to that point again to see if it runs correctly now.

How do you set break points in a VFP Form's Command Buttons???
The 2nd mouse gets the cheese.
 
VFP has a very powerful debugger too. In any line of code you want (again regardless prg or control procedure) right click this line and choose &quot;set breakpoint&quot;.
CTRL+F2 will activiate your command window and giving you a great tool to run commands in the run time or define/change value of a variable. You don't have to cancel->Fix->Run again. I think you need to consider reading a debuging chapter in any good book in VFP.
Good luck.
Walid
Engwam@Hotmail.com
 
Hey Walid,

Thanks for the tips. I'm a VB programmer/database. I haven't used FoxPro since mfoxplus.exe circa 1990. (Makes me feel old just saying that). I had a chat with a Foxpro contractor here that told me you had to stop and restart on errors. I just assumed he knew what he was talking about. Thanks again.
The 2nd mouse gets the cheese.
 
Well, from what I know. Your consultant was right. You do have to re-run the program back from the beginning in order to test your modifications.
Don
dond@csrinc.com

 
Well dondas,
My full respect, but I don't think so.
let's do that, a simple prg has only two lines of code

Code:
X=Y
? X

Run, you will get a Program Error : Variable Y is not found.
Click Suspend, Activiate window command [CTRL+F2] and type
Code:
Y=3
Resume

Your program will continue and will print 3 in the main window. This will give you a chance to continue debuging without Cancel->Fix->Run again just to define your variable.
This was my point.
Thanks for your feedback
Walid
 
Hi guys!

Susp command suspends a program, but you will not know that it is suspended until open debugger window. Following command is more useful:

set step on

It suspends program and opens debugger window (or watch and trace windows when you don't use standalone debugger window).

I always use above command.

Finaly, to trap some event even if it is called from base classes, open form, open code snippet for required event (for example, command button click event code) and put following lines:

set step on
dodefault()

Don't forget to pass parameters of event in dodefault() function if any, for example, you will need this for such events like MouseDown.



Vlad Grynchyshyn
vgryn@softserve.lviv.ua
The professional level of programmer could be determined by level of stupidity of his/her bugs
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top