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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting Breakpoints In VFP 7 2

Status
Not open for further replies.

drosenkranz

Programmer
Sep 13, 2000
360
US
Hello,

I'm having some trouble with breakpoints that don't break the program's execution. I am setting them by double clicking in the left margin of the code window behind a control on the form which marks that line with the red dot. I have checked in the Trace Window and the breakpoint is shown there. It's a Type = "Break At Location" which I am interpreting as an unconditional breakpoint.

I'm visiting from the VB world and I'm not sure why the VFP breakpoints are passed over. Any help would be greatly appreciated.

Thanks,

Dave The 2nd mouse gets the cheese.
 
One small correction:

I was checking them by using <Ctrl> <B> to see if the breakpoint was actually shown under Breakpoints - not in the Trace window. The 2nd mouse gets the cheese.
 
Assuming that's the code you are really running and you actually execute that line (don't put breakpoints on declarations, blank lines or comments!), it will stop - honest!

Rick
 
Below is the code from the KeyPress Event of the text box.

The breakpoint was set on the first &quot;IF&quot; statement but when the program runs, it will proceed right through to the messagebox. In this case, I entered no information in the text box and simply pressed the <Enter> key.

IF nKeyCode = 13 && <Enter> key pressed
private strMsg as String
*
gc_search_val = alltrim(thisform.txtsearchfor.value)
*
IF len(gc_search_val) = 0 THEN
strMsg = &quot;You Must Enter A Value To Search For.&quot;
messagebox (strMsg)
return
ENDIF
...
...
ENDIF

Any ideas?

Dave The 2nd mouse gets the cheese.
 
drosenkranz

Try putting a 'SET STEP ON' instead
Code:
SET STEP ON
IF nKeyCode = 13 && <Enter> key pressed
    private strMsg as String 
    *
    gc_search_val = alltrim(thisform.txtsearchfor.value) 
    *
    IF len(gc_search_val) = 0  THEN
        strMsg = &quot;You Must Enter A Value To Search For.&quot;
        messagebox (strMsg)
        return
    ENDIF
              ...
              ...
ENDIF

Mike Gagnon
comp14.gif
 
Set Step On works correctly...it's only the breakpoints that fail. If I Set Step On, each of the statements in this code executes. Is there anything under <Tools> & <Options> that can be affecting the breakpoints ?

Thanks,

Dave The 2nd mouse gets the cheese.
 
drosenkranz

Set Step On works correctly...it's only the breakpoints that fail. If I Set Step On, each of the statements in this code executes. Is there anything under <Tools> & <Options> that can be affecting the breakpoints ?

I don't know, I never use breakpoints, always SET STEP, but seems to me I heard at a Devcon that breakpoints were buggy (maybe I'm wrong)



Mike Gagnon
comp14.gif
 
Dave,
The only thing I've found that can mess up (a technical term) BPs, is changing the code without resetting the BP. Since in this mode all that's stored is a line number, if you modify the source code, the line numbers will change, and the BP may end up on a non-breakable line. It's been suggested that Toledo will implement this differently, so BPs stay on the actual line of code (assuming it hasn't been altered!).

Rick
 
IF nKeyCode = 13 && <Enter> key pressed
private strMsg as String
*
gc_search_val = alltrim(thisform.txtsearchfor.value)
*

** this may be the problem, fox does not use THEN
IF len(gc_search_val) = 0 THEN
strMsg = &quot;You Must Enter A Value To Search For.&quot;
messagebox (strMsg)
return
ENDIF
...
...
ENDIF
Attitude is Everything
 
Danceman,
Actually it appears that THEN is a valid [optional] field on the IF line, starting in VFP 5.0.

Note: It's also well known and undocumented that you can put (most) anything after ENDIF (and ENDFOR) as a comment!

Rick
 
rgbean
I am aware of the ability to put then or other things. I am stabing at the dark here. I have never not had a break point function. just trying things.

never could understand whyfox added the THEN to the IF, when I really provides no usfull function. Attitude is Everything
 
Hello,

Thanks for all the feedback but I need a little more. I set 4 breakpoints (BP's) in the keypress event code of a textbox. I set 2 from the code window and 2 in the trace window. I used 2 on &quot;IF&quot; statements and 2 on &quot;DO CASE&quot; statements and not a single one of them worked!

Later, in the day, I saw that the BP's had actually shifted to other lines near the original BP's (as rgbean had explained earlier). When using Set Step On, I can see that the code where the BP's were placed is in fact actually executing. When I Set Step Off, the program just blows right by them.

I have not really used VFP since 1990 (until I restarted work in 2001). I know I'm still scraping some rust off but come on... There has got to be a reason that &quot;none&quot; of my BP's work.

In the VB world, those BP's are reliable. I wanted to know if the BP's have actually worked for anyone in VFP?

Thanks Again For Your Time,

Dave
The 2nd mouse gets the cheese.
 
Dave,
I usually either use the &quot;set step on&quot; technique, or in the debugger I set conditional BPs (e.g. var=<something> in given proc, or break when condition t/f), these seem to work fine.

Rick
 
Dave

There a few &quot;known&quot; bugs about breakpoints, even though they don't specifically apply to VFP7.0,I have worked with VFP5.0 and VFP6.0 without using them, I certainaly didn't want to start finding the bugs. I have enough of my own.



Mike Gagnon
comp14.gif
 
Hello Gentlemen,

Your responses are always helpful - with a side order of humor.

Thanks for the info and your time. (and the sites too)

Dave

The 2nd mouse gets the cheese.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top