Focus problem with TGet class

Post Reply
User avatar
Maurilio Viana
Posts: 252
Joined: Tue Oct 25, 2005 2:48 pm
Location: Garça/Garza/Heron City - Brazil
Contact:

Focus problem with TGet class

Post by Maurilio Viana »

Dear Antonio,

We detect a strange problem with gets when we have a sequence like
get1, get2, getN, pushbutton and getN have a valid/when condition or
when pushbutton depend of getN valid/when. For any cause that we couldn't
detect pushbutton don't get the focus. We couldn't isolate a little
situation when it occur but I detected that it occur only when we use
enter key to skip to next control. Using tab key the navigation by the
controls, validations and when is evaluated correctly.
I changed a bit the code from KeyChar method in window.prg to test if
tab OR enter was pressed to skip to next control as follow.
My focus problems was solved and I hope the similar
problem of another user too.

Code: Select all

METHOD KeyDown( nKey, nFlags ) CLASS TWindow

   local bKeyAction := SetKey( nKey )

   if nKey == VK_TAB .and. ::oWnd != nil .and. GetKeyState( VK_SHIFT )
      ::oWnd:GoPrevCtrl( ::hWnd )
      return 0
   endif

   if (nKey == VK_TAB .or. nKey == VK_RETURN) .and. ::oWnd != nil // <-- Here
      ::oWnd:GoNextCtrl( ::hWnd )
      return 0
   endif
(...)
Regards,
Maurilio
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

Maurilio,

Does this create a problem with the Enter key triggering the default pushbutton?

Remember that the Tab key is the Windows standard for moving from field to field. The Enter key was used in DOS apps. Most users are going to expect the Enter key to trigger the default pushbutton.

James
User avatar
Maurilio Viana
Posts: 252
Joined: Tue Oct 25, 2005 2:48 pm
Location: Garça/Garza/Heron City - Brazil
Contact:

Post by Maurilio Viana »

James,

My fault! I forgot to mention it can be used only by users that have these focus problems.
I don´t tested with default pushbuttons yet.
In FWH 2.6 worked fine, when I migrate to 2.7 I had this focus problems when I use any sequence of when/valid clauses in gets and/or pushbuttons.

Regards,
Maurilio
Post Reply