Dear Vixens and Reynards:
OKL is often reviled, but I just found a very good use for it
in debugging.
I am debugging a .BeforeRowColChange method. I want to
single-step through the method to find the error. The problem is
that I do not want to single-step through it unless it is the firing
when the form has been selected to be closed. Single-stepping
through other firings can cause my form to get messed up because the
debugger can affect focus. It is critical in this case since I am
debugging event firing.
Here is my code:
Setup (in program startup)
-----
* Debugging Activation Setup
private debugstepping
debugstepping=.f.
on key label "Ctrl-D" setdebugstepping()
Procedure that sets variable
----------------------------
* setdebugstepping
* Set debugstepping Variable
* Last Modification: 2014-03-21
procedure setdebugstepping
debugstepping=.t.
clear typeahead
=messagebox("debugstepping has been set to .t..",MB_OK,"DEBUGGING")
return
endproc
Use (in .BeforeRowColChange())
---
if debugstepping
set step on
endif
Now, I just run my program until I get to where I want to test
then press Ctrl-D. The next .BeforeRowColChange() can now be
single-stepped through. The other firings are not.
I wish I had thought of this idea years ago. Debugging
connected with event firing has been so awkward.
Sincerely,
Gene Wirchenko
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
You might want to look at using ASSERTS. Very useful for triggering the debug process in a controlled way.
-----Original Message-----
From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Gene Wirchenko
Sent: Friday, March 21, 2014 5:59 PM
To: profoxtech@leafe.com
Subject: A Use for OKL
Dear Vixens and Reynards:
OKL is often reviled, but I just found a very good use for it in debugging.
I am debugging a .BeforeRowColChange method. I want to single-step through the method to find the error. The problem is that I do not want to single-step through it unless it is the firing when the form has been selected to be closed. Single-stepping through other firings can cause my form to get messed up because the debugger can affect focus. It is critical in this case since I am debugging event firing.
Here is my code:
Setup (in program startup)
-----
* Debugging Activation Setup
private debugstepping
debugstepping=.f.
on key label "Ctrl-D" setdebugstepping()
Procedure that sets variable
----------------------------
* setdebugstepping
* Set debugstepping Variable
* Last Modification: 2014-03-21
procedure setdebugstepping
debugstepping=.t.
clear typeahead
=messagebox("debugstepping has been set to .t..",MB_OK,"DEBUGGING")
return
endproc
Use (in .BeforeRowColChange())
---
if debugstepping
set step on
endif
Now, I just run my program until I get to where I want to test then press Ctrl-D. The next .BeforeRowColChange() can now be single-stepped through. The other firings are not.
I wish I had thought of this idea years ago. Debugging connected with event firing has been so awkward.
Sincerely,
Gene Wirchenko
[excessive quoting removed by server]
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/DF1EEF11E586A64FB54A97F22A8BD04422A71B02B7@ACKBWDDQH1.artfact.local
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
At 04:33 2014-03-24, Richard Kaye <rkaye@invaluable.com> wrote:
>You might want to look at using ASSERTS. Very useful for triggering
>the debug process in a controlled way.
If you can define an expression that covers the
case. Sometimes, the condition is higher-level than VFP.
[snip]
Sincerely,
Gene Wirchenko
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
You're right, Gene. Nothing can cover all situations. But any logical condition will do. Two generic strategies I've used when I don't necessarily have some well-defined condition are:
ASSERT .F. MESSAGE [Debug now?]
And
ASSERT NOT FILE([debugnow.txt]) MESSAGE [debug now?]
The first is pretty much a sledge hammer so every time I use that one I get prompted about going into debug mode. The latter allows me to control the debug prompt by using the presence or absence of an external file as opposed to some application condition.
--
rk
-----Original Message-----
From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Gene Wirchenko
Sent: Tuesday, March 25, 2014 3:01 PM
To: profoxtech@leafe.com
Subject: RE: A Use for OKL
At 04:33 2014-03-24, Richard Kaye <rkaye@invaluable.com> wrote:
>You might want to look at using ASSERTS. Very useful for triggering the
>debug process in a controlled way.
If you can define an expression that covers the case. Sometimes, the condition is higher-level than VFP.
[snip]
Sincerely,
Gene Wirchenko
[excessive quoting removed by server]
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/DF1EEF11E586A64FB54A97F22A8BD04422A727A6FD@ACKBWDDQH1.artfact.local
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
At 13:17 2014-03-25, Richard Kaye <rkaye@invaluable.com> wrote:
>You're right, Gene. Nothing can cover all situations. But any
>logical condition will do. Two generic strategies I've used when I
>don't necessarily have some well-defined condition are:
>
>ASSERT .F. MESSAGE [Debug now?]
>
>And
>
>ASSERT NOT FILE([debugnow.txt]) MESSAGE [debug now?]
>
>The first is pretty much a sledge hammer so every time I use that
>one I get prompted about going into debug mode. The latter allows me
>to control the debug prompt by using the presence or absence of an
>external file as opposed to some application condition.
I was using a variety of sledgehammer. Having to skip through
a bunch of unneeded stuff is a timewaster. When the issue is
event-related, it can also result in the event firings being different.
The OKL approach is even simpler than creating a file. Just
enter a keystroke.
[snipped previous]
Sincerely,
Gene Wirchenko
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
As long as you have a wait state to accept the keystroke. :-)
--
rk
-----Original Message-----
From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Gene Wirchenko
Sent: Wednesday, March 26, 2014 1:26 PM
To: profoxtech@leafe.com
Subject: RE: A Use for OKL
I was using a variety of sledgehammer. Having to skip through a bunch of unneeded stuff is a timewaster. When the issue is event-related, it can also result in the event firings being different.
The OKL approach is even simpler than creating a file. Just enter a keystroke.
[snipped previous]
Sincerely,
Gene Wirchenko
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/DF1EEF11E586A64FB54A97F22A8BD04422A727AB09@ACKBWDDQH1.artfact.local
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
Using
_vfp.AutoYield = .t.
the keyboard is polled between code lines instead that only at a wait state.
AutoYield Property
http://msdn.microsoft.com/en-US/library/tzw0kthk(v=vs.80).aspx
Gianni
On Wed, 26 Mar 2014 16:38:33 -0400, Richard Kaye <rkaye@invaluable.com> wrote:
As long as you have a wait state to accept the keystroke. :-)
--
rk
-----Original Message-----
From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Gene Wirchenko
Sent: Wednesday, March 26, 2014 1:26 PM
To: profoxtech@leafe.com
Subject: RE: A Use for OKL
I was using a variety of sledgehammer. Having to skip through a bunch of unneeded stuff is a timewaster. When the issue is event-related, it can also result in the event firings being different.
The OKL approach is even simpler than creating a file. Just enter a keystroke.
[snipped previous]
Sincerely,
Gene Wirchenko
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/48h6j9dqs81kqp5rv351d0698p51k351iv@4ax.com
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
At 13:38 2014-03-26, Richard Kaye <rkaye@invaluable.com> wrote:
>As long as you have a wait state to accept the keystroke. :-)
Good point.
I have exactly that though. The trouble I have had is when
using the debugger causes other events to fire. This is not fun when
the code works when using the debugger, but not when not.
[snip]
Sincerely,
Gene Wirchenko
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
At 14:28 2014-03-26, Gianni Turri <giannit62@gmail.com> wrote:
>Using
>
>_vfp.AutoYield = .t.
>
>the keyboard is polled between code lines instead that only at a wait state.
Thank you. I would not have thought of that since it is one of
those commands that one does not think of if one has not used
it. And then, there is remembering what it is called.
[snip]
Sincerely,
Gene Wirchenko
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
Yeah, been bitten by that one many times. Like setting a breakpoint on a line of code in the Activate method is a recipe for hair-pulling...
--
rk
-----Original Message-----
From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Gene Wirchenko
Sent: Wednesday, March 26, 2014 5:43 PM
To: profoxtech@leafe.com
Subject: RE: A Use for OKL
I have exactly that though. The trouble I have had is when using the debugger causes other events to fire. This is not fun when the code works when using the debugger, but not when not.
[snip]
Sincerely,
Gene Wirchenko
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/DF1EEF11E586A64FB54A97F22A8BD04422A727AB80@ACKBWDDQH1.artfact.local
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.