Paradox Community

Items in pnews.paradox-programming

Subject:Re: Custom Error proc strange issue
Date:Sat, 1 Dec 2018 05:28:13 -0500
From:"Kevin Baker" <shcsbaker@gmail.com>
Newsgroups:pnews.paradox-programming
Mark-

There was code on the removeFocus of the form (unlockRecord), keep in mind 
I'm working with code I didn't write, so I'm not sure why this code was 
there.  Once I remove that bit of code, I get the desired result, so I'll 
dig a little into why this code was there, just seems like a catch all to 
"save" the record if the user navigates to another form.

Thanks for the help
Kevin

"Mark Bannister"  wrote in message news:5c01426b@pnews.thedbcommunity.com...

Kevin:
Run the tracer with code showing.  Looks like your code should be
running.  ... The error is tripped by the changevalue. So your code must
not be detecting the error.  Turn on a breakpoint in your code and look
at the newvalue and values when this happens.

Honestly I hate working with the UI.  It always screws me up.

On 11/27/2018 4:03 PM, Kevin Baker wrote:
> Hoping someone can walk me through what this is telling me:
>
> I have a form, with a tableframe called Visitor, one of the fields is a 
> date field.  Here is the code I have on the Change Value of the Date 
> Field:
> ===============================================
> method changeValue(var eventInfo ValueEvent)
>
> var
>     nd,od date
> endvar
>
> od=self.value
> nd=eventInfo.newValue()
>
> if year(nd) <=1900 then
>    msginfo("","Invalid Date, Undoing Changes.")
>    eventInfo.setErrorCode(CanNotDepart)
>     self.action(editUndoField)
> endif
>
> try
>     eventInfo.setNewValue(Date(eventInfo.newValue()))
> onFail
>    msginfo("","Date Failed") ;used to help debug
>    errorClear()
>     eventInfo.setErrorCode(CanNotDepart)
>     self.action(editUndoField)
>     return
> endTry
> endMethod
> ===============================================
> In my testing, I go to the record on the TF and change the date 
> (12/25/2018) by just backspacing the 8 off the end, so it has the value of 
> 12/25/201 then I move to the next field (by pressing TAB).  The code on 
> the change value works and resets the date back to 12/15/2018.  When I 
> change the date to 15/25/2018, the change value on the field doesn't run 
> and this is the info from the Tracer:
>
> ===============================================
>  From Tracer Window:
> BuiltIn:changeValue, self = 
> "Page1.NBook1.NPVis.Visitor.#Record33.Date_Of_Visit", 
> target="Page1.NBook1.NPVis.Visitor.#Record33.Date_Of_Visit", 
> reason=FieldValue, val="15/25/2018"
> BuiltIn:error, self = 
> "Page1.NBook1.NPVis.Visitor.#Record33.Date_Of_Visit", 
> target="Page1.NBook1.NPVis.Visitor.#Record33.Date_Of_Visit"
> Pass:error, self = "Page1.NBook1.NPVis.Visitor.#Record33", 
> target="Page1.NBook1.NPVis.Visitor.#Record33.Date_Of_Visit"
> Pass:error, self = "Page1.NBook1.NPVis.Visitor", 
> target="Page1.NBook1.NPVis.Visitor.#Record33.Date_Of_Visit"
> Pass:error, self = "Page1.NBook1.NPVis", 
> target="Page1.NBook1.NPVis.Visitor.#Record33.Date_Of_Visit"
> Pass:error, self = "Page1.NBook1", 
> target="Page1.NBook1.NPVis.Visitor.#Record33.Date_Of_Visit"
> Pass:error, self = "Page1", 
> target="Page1.NBook1.NPVis.Visitor.#Record33.Date_Of_Visit"
> Pass:error, self = "dataentry3fdl", 
> target="Page1.NBook1.NPVis.Visitor.#Record33.Date_Of_Visit"
> ===============================================
>  From Marks Program
> BuiltIn.changeValue () 
> Page1.NBook1.NPVis.Visitor.#Record33.Date_Of_Visit--", 
> target="Page1.NBook1.NPVis.Visitor.#Record33.Date_Of_Visit", 
> reason=FieldValue, val="15/25/2018"---builtin
> BuiltIn.error () Page1.NBook1.NPVis.Visitor.#Record33.Date_Of_Visit--", 
> target="Page1.NBook1.NPVis.Visitor.#Record33.Date_Of_Visit"---builtin
> Pass.error () Page1.NBook1.NPVis.Visitor.#Record33--", 
> target="Page1.NBook1.NPVis.Visitor.#Record33.Date_Of_Visit"---builtin
> Pass.error () Page1.NBook1.NPVis.Visitor--", 
> target="Page1.NBook1.NPVis.Visitor.#Record33.Date_Of_Visit"---builtin
> Pass.error () Page1.NBook1.NPVis--", 
> target="Page1.NBook1.NPVis.Visitor.#Record33.Date_Of_Visit"---builtin
> Pass.error () Page1.NBook1--", 
> target="Page1.NBook1.NPVis.Visitor.#Record33.Date_Of_Visit"---builtin
> Pass.error () Page1--", 
> target="Page1.NBook1.NPVis.Visitor.#Record33.Date_Of_Visit"---builtin
> Pass.error () dataentry3fdl--", 
> target="Page1.NBook1.NPVis.Visitor.#Record33.Date_Of_Visit"---builtin
> BuiltIn.error () Page1.NBook1.NPVis.Visitor.#Record33.Date_Of_Visit--", 
> target="Page1.NBook1.NPVis.Visitor.#Record33.Date_Of_Visit"---builtin
> Pass.error () Page1.NBook1.NPVis.Visitor.#Record33--", 
> target="Page1.NBook1.NPVis.Visitor.#Record33.Date_Of_Visit"---builtin
> Pass.error () Page1.NBook1.NPVis.Visitor--", 
> target="Page1.NBook1.NPVis.Visitor.#Record33.Date_Of_Visit"---builtin
> Pass.error () Page1.NBook1.NPVis--", 
> target="Page1.NBook1.NPVis.Visitor.#Record33.Date_Of_Visit"---builtin
> Pass.error () Page1.NBook1--", 
> target="Page1.NBook1.NPVis.Visitor.#Record33.Date_Of_Visit"---builtin
> Pass.error () Page1--", 
> target="Page1.NBook1.NPVis.Visitor.#Record33.Date_Of_Visit"---builtin
> Pass.error () dataentry3fdl--", 
> target="Page1.NBook1.NPVis.Visitor.#Record33.Date_Of_Visit"---builtin
> ===============================================
>
> I'm confused at why the code on change value fires when I leave off a 
> digit in the year, but doesn't fire for bad month, Is the tracer suppose 
> to show me where the code is firing from on the bad month test?
>
> Any and all help is very much welcomed.
>
> Thanks
> Kevin
>
> "Kevin Baker"  wrote in message 
> news:5bfda70e$1@pnews.thedbcommunity.com...
>
> Wow, that does clean things up a lot!  I've gone down this road before, I
> know the tracer is a powerful tool and I've read everything I can find 
> about
> it, but it still just looks like a different language to me.  It's like
> having directions to buried treasure written in a language you don't 
> know...
> very frustrating.  Added to this is I've been working with code I didn't
> write that has been added to (and updated) over the years by many others.
>
> I'll continue to dig into this... I'm hopeful at some point it will click
> and make sense.
>
> Thanks,
> Kevin
>
> "Mark Bannister"  wrote in message
> news:5bfd9c75$1@pnews.thedbcommunity.com...
>
> Try this form.  You can't just open it, you have to run it first to
> create temp tables.  If that is a little scary I pasted the table build
> code below.  Run that first and then you can open the form in design mode.
> It will parse the tracer code into something more readable and it gives
> you a "button bar" to control the tracer with.  You will need to change
> the pushbutton code of the parse tracer button so that it opens the
> program you want to show the output.
>
> Deliver this form, then run the delivered version (so it can run modal).
>   Then use the buttons to control and parse tracer data.
>
> This allows you to search the tracer data in a text editor and gives a
> more readable format.
>
> There is a LOT of extraneous code in this version that I didn't bother
> to take out.
>
>
> method BuildTables()
> var
> mytbl table
>     stname  string
>     mytc tcursor
> endvar
> try
> stname = dmgetproperty(TraceOutputdm'tablename,"FullName")
> stName=":PRIV:__tracerOutput.db"
>
> mytbl = create  stName
>   with
>    "ID":"I",
>    "ObjectName":"A100",
>    "MethodName":"A100",
>    "LineNum":"I",
>    "Code":"A255",
>    "Indent":"I",
>    "BuiltIn" : "S",
>    "RecColor" : "I",
>    "LineType" :"I",  ;1 start, 2 end, 3 continue
>    "LineFilter" : "A200",
>    "LoShow" : "S",
>    "CollapseType" : "I" , ;
>    "Codetimestamp" : "I"
> ;  "display" : "F1"
>   key
>    "ID"
> endCreate
> sleep()
> onfail
> errorshow()
> endtry
>
>
> On 11/27/2018 1:15 PM, Kevin Baker wrote:
>> that does help cut down on the sheer volume of information.  Thanks!
>>
>> "Mark Bannister"  wrote in message
>> news:5bfd8c34$1@pnews.thedbcommunity.com...
>>
>> For this, turn off tracing code and just trace the error method.  Look
>> at the "target" and other UI object data.
>>
>> On 11/27/2018 9:33 AM, Kevin Baker wrote:
>>> Hi Mark,
>>>
>>> Me and that Tracer have never really got a long, but I think you're
>>> right in that it will show me... it's always been hard for me to
>>> follow along with it.
>>>
>>> I'll let you know if I discover anything.
>>>
>>> Thanks,
>>> Kevin
>>>
>>> "Mark Bannister"  wrote in message
>>> news:5bfd605d$1@pnews.thedbcommunity.com...
>>>
>>> Should have been more specific.
>>> Use the tracer and trace the error.  See where it is getting sent when
>>> you hit the tab keys.  You most likely just need to move where your code
>>> is.  If you have to move it off the field you will have to do some
>>> checking as to the error or the object.
>>>
>>> On 11/27/2018 9:17 AM, Mark Bannister wrote:
>>>> Where is your error code?
>>>>
>>>> On 11/27/2018 8:27 AM, Kevin Baker wrote:
>>>>> On my form, I'm using custom error handling.  I have a tableFrame
>>>>> with a date field.  It's been reported and I've spent the last few
>>>>> hours looking at this trying to figure this out.  If I type in an
>>>>> invalid date AND then click the next field with the mouse, I get my
>>>>> custom error message, if I type in an invalid date and press ENTER
>>>>> or TAB, I get the paradox error message (the box where you have to
>>>>> press the >> button).
>>>>>
>>>>> Does anyone know how I can get the ENTER and TAB keys to display the
>>>>> custom error handling?
>>>>>
>>>>> Thanks
>>>>> Kevin
>>>>
>>
> 


Copyright © 2004 thedbcommunity.com