Subject Re: pushbutton
From Lee Grant <camilee@nospam.comcast.net>
Date Tue, 29 Nov 2022 18:32:10 -0500
Newsgroups dbase.getting-started
Attachment(s) ghor.wfm

Mustansir,

I've been playing with this and it's been bugging me, because sometime
the tab enter worked, other times it didn't. I suspect that the problem
is not going to be obvious.

My first take was why are you trying to hit tab and enter to make the
text appear in the Text label object, when simply hitting tab after the
last entryfield could have triggered the entry by onLostFocus for the
entryfield, or the onGotFocus property of the Text label object...but
regardless, I view a pushbutton as that, to be used as a pushbutton with
a mouse. If using data entry keyboard only, the space key once it has
the focus should be exactly what you need. I tried making sure CUAENTER
was set on in the .wfm, but apparently that has no effect...as it did in
a previous newsgroup help request.

So I started trying to narrow down why it worked for me once, but not
consistently, and I found out that to make it work consistently with the
tab from the entryfield -> pushbutton....this is the procedure you need
to follow.

Click the dropdown box, select a name (I put an empty space for first
choice), click the entryfield. Type the amount and then tab to the
pushbutton and hit enter and it works everytime. Apparently, to me, the
mouse clicking in the dropdown and entryfield seems to be making the
mouse the focus in those objects and when you finally tab to the
pushbutton, it truly is moving the Focus..whereas when you click the
dropbox, and tab to the entryfield and enter an amount and then tab to
the pushbutton, it takes two times to hit the enter key to move the
focus over to the actual pushbutton and then the second one executes it.
I wish I had some experience getting a screen movie of what I'm
describing so it would be clear, but I suspect that not using the mouse
to move between objects is the reason when you finally tab to the
pushbutton, that the focus isn't really where it should be. Best way I
know to describe this behavior.
I'm including your file with my changes so there isn't a 'default'
selection in the dropbox.

Lee

On 11/29/2022 1:57 PM, Mustansir Ghor wrote:
> Dear Ken sir and Mervyn Sir
>
> I am little scared for posting this here. In case my observation proves wrong then its ok but I need to put it here. I tested Mervyn Sir program and even before posting my issue i had made samething as selftest. However to portray my problem I simplified my form and attaching here.
>
> The form has 4 objects. Combobox, Entryfield, Pushbutton and text.
>
> The combobox is filled with array data (sample data).
>
> When you run the form, comboxbox gets focus, you can select anydata and press Tab key. It goes to Entryfield, here you need to enter amount (any amount) and then press Tab key again so it moves to pushbutton (here if you click or press space bar then it works fine and displays the contents in text box) . If you press Enter key once nothing happens, On pressing 2nd time it then displays  the contents in text box.
>
> On otherhand when focus comes to Entryfield and after typing the value you press Enter key  and then move to pushbutton with Tabkey, then pushbutton works on 1st instance.
>
> Pls bear with me if my observations are proven wrong but it will help to correct myself as to where I am making mistake.
>
> Thanking you all
>
> Best Regards
> Mustansir
<snip>




** END HEADER -- do not remove this line
//
// Generated on 11/29/2022
//
parameter bModal
local f
f = new ghorForm()
if (bModal)
   f.mdi = false // ensure not MDI
   f.readModal()
else
   f.open()
endif

class ghorForm of FORM
   with (this)
      onOpen = class::FORM_ONOPEN
      metric = 0        // Chars
      height = 8.5455
      left = -0.4286
      top = -0.5455
      width = 122.2857
      text = ""
   endwith

   this.CBCUSTOMER = new COMBOBOX(this)
   with (this.CBCUSTOMER)
      height = 1.5
      left = 6.0
      top = 3.5
      width = 39.0
      fontSize = 14.0
      dataSource = 'array {"","MUSTANSIR","GHOR","DAR","TZ"}'
      style = 1        // DropDown
   endwith

   this.EAMOUNT = new ENTRYFIELD(this)
   with (this.EAMOUNT)
      height = 1.5
      left = 51.0
      top = 3.5
      width = 18.0
      fontSize = 14.0
      value = ""
      validRequired = true
   endwith

   this.PBSAVE = new PUSHBUTTON(this)
   with (this.PBSAVE)
      onClick = class::PBSAVE_ONCLICK
      height = 1.5
      left = 77.0
      top = 3.5
      width = 14.0
      text = "Display It"
   endwith

   this.TEXT1 = new TEXT(this)
   with (this.TEXT1)
      height = 1.0
      left = 7.0
      top = 6.0
      width = 54.0
      text = "Text1"
   endwith


   function PBSAVE_onClick()
         form.text1.text=""
         form.text1.text=form.cbcustomer.value+" has following balance "+form.eamount.value
      return


   function form_onOpen()
         with(this)
          height = 8.5
     left = 20.0
     top = 3.0
     width = 120.0
         endwith
        
     return


endclass