Subject Re: entryfield focus
From Mervyn Bick <invalid@invalid.invald>
Date Mon, 22 Apr 2019 22:46:24 +0200
Newsgroups dbase.getting-started

On 2019-04-22 10:29 PM, Charlie wrote:
> I have a form where I have a trigger on an entryfield that fires when it gains focus and when it loses focus.  It works great but on-open evidently the entryfield gets focus and loses focus and triggers some code that is undesired.  Is there a way to fix this?  Thanks!!!

Instead of assigning the onGotFocus and onLostFocus event handlers in
the constructor code for the entryfield assign the event handlers in the
form's onOpen event handler.

   this.ENTRYFIELD1 = new ENTRYFIELD(this)
    with (this.ENTRYFIELD1)
//      onGotFocus = class::ENTRYFIELD1_ONGOTFOCUS
//      onLostFocus = class::ENTRYFIELD1_ONLOSTFOCUS
       height = 1.0
       left = 12.0
       top = 2.5
       width = 8.0
       value = "Entryfield1"

    function form_onOpen()
       form.entryfield1.onGotFocus := class::ENTRYFIELD1_ONGOTFOCUS
       form.entryfield1.onLostFocus := class::ENTRYFIELD1_ONLOSTFOCUS