Dotted not properly painted on focus

Dotted not properly painted on focus

Postby Antonio Linares » Fri Oct 14, 2011 7:40 pm

This is a long time searched bug that finally has been found and fixed :-)

If there is a GET just before a ComboBox, you will notice that pressing TAB the combobox does not show its dotted focus the first time, though next times are fine. The same applies for a GET before a Button.

That behavior is caused because the GET is returning DLGC_WANTALLKEYS in response to Windows msg WM_GETDLGCODE. Something allowed by Windows but that causes that non desired effect. Simply modify Class TGet Method GetDlgCode() this way and the dotted focus will be properly shown:

Code: Select all  Expand view
METHOD GetDlgCode( nLastKey ) CLASS TGet

   if Len( ::oWnd:aControls ) == 1
      return DLGC_WANTALLKEYS
   endif

   ::oWnd:nLastKey = nLastKey

return nil // DLGC_WANTALLKEYS
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42085
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Dotted not properly painted on focus

Postby Antonio Linares » Sat Oct 15, 2011 9:29 am

To have also the same right behavior when pressing Enter, we have implemented the following:

We have implemented a new function SendKey() based on Windows API function SendInput():
viewtopic.php?f=6&t=22664&p=120948#p120948

so Class TWindow Method GoNextCtrl() changes this way:
Code: Select all  Expand view
METHOD GoNextCtrl( hCtrl ) CLASS TWindow

   local hCtlNext, nAt

   if Upper( ::ClassName() ) != "TDIALOG"
      nAt = AScan( ::aControls, { | o | o:hWnd == hCtrl } )
      if nAt != 0
         if nAt < Len( ::aControls )
            hCtlNext = ::aControls[ nAt + 1 ]:hWnd
         else
            hCtlNext = ::aControls[ 1 ]:hWnd
         endif
         if lAnd( GetWindowLong( hCtlNext, GWL_STYLE ), WS_TABSTOP )
            SetFocus( hCtlNext )
         endif
         return nil
      endif
   endif

   if ! Empty( ::aControls ) .and. hCtrl == ::LastActiveCtrl():hWnd
      if ! Empty( ::oWnd ) .and. ;
         ( ( Upper( ::oWnd:ClassName() ) $ "TFOLDER;TPAGES;TFOLDEREX" ) )
         hCtlNext = NextDlgTab( ::oWnd:oWnd:hWnd, ::oWnd:hWnd )
         ::hCtlFocus = hCtrl
         SetFocus( hCtlNext )
      endif
   else
      SendKey( VK_TAB )
   endif

return nil

 


And a new Method GetDlgCode() for Class TComboBox:
Code: Select all  Expand view
METHOD GetDlgCode() VIRTUAL
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42085
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Dotted not properly painted on focus

Postby carlos vargas » Mon Oct 17, 2011 3:04 pm

Antonio, aca esta funcionando al 100% con los cambios indicado en tget, twindows y tcombobox.

salu2
carlos vargas
Salu2
Carlos Vargas
Desde Managua, Nicaragua (CA)
User avatar
carlos vargas
 
Posts: 1720
Joined: Tue Oct 11, 2005 5:01 pm
Location: Nicaragua

Re: Dotted not properly painted on focus

Postby Antonio Linares » Mon Oct 17, 2011 3:05 pm

Carlos,

bien, gracias! :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42085
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Dotted not properly painted on focus

Postby carlos vargas » Mon Oct 17, 2011 4:14 pm

Antonio, estando el get en un folder, no realiza el salto al siguiente control en el folder sino que hacia el siguiente control el dialogo contenedor del folder.

salu2
Salu2
Carlos Vargas
Desde Managua, Nicaragua (CA)
User avatar
carlos vargas
 
Posts: 1720
Joined: Tue Oct 11, 2005 5:01 pm
Location: Nicaragua


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 111 guests