Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Catching error information
Message
From
28/06/2018 00:33:06
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01660874
Message ID:
01660922
Views:
60
>>>Thank you. But now I am wondering if, when I will be looking at the error log much later after the error occurred, if these values will make sense to me. Ideally it would be nice to know which button or grid or object where the user clicked last (that fired something that caused the error). But I don't know how to get it.
>>
>>Either write a hook pattern into the uppermost base class of your clickable controls or employ bindevent() to selectively hook some controls.
>>Text logs easy and probably not huge (one line per click) but needing to be cleaned on each program start. If you employ a sngle error log, your hook code could also fill a small stack of "latest clicked controls" with timestamp which could be serialized into your errorlog to give "current" latest clicks.
>
>Writing a hook pattern or employ bindevent() is over my head. It will most likely break something. And I do maintain a pretty complete text log of errors. But sometimes the description does not give me enough information to duplicate it (on my PC). This is why I will be adding some more info to the text log (e.g. lastkey()).

I think the hook pattern is one of the easiest pattern - but you need discipline in your code if you hook many things, as all methods need to call their dodefault().

Typically it implementation follows the rule of "events call methods" by filling the events in base classes with a simple template like

click_before()
click_execution()
click_teardown()

The code often found directly in .click either goes into click_execution or a function called via property.
Your code for logging would move into click_before()...

For retrofitting code not written along some OOP principles/patterns as main approach, bindevent is a patch often fitting/easier to adapt.

Worth learning - after CA best feature introduced after vfp7 IMO.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform