Jump to content
Fivewin Brasil

Problema com foco em Get


CamilaFonseca

Recommended Posts

Bom dia,

Após atualizar para FiveWin 15.3, estamos tendo um problema nas telas.

Ao clicar em um botão com ícone, ele abre uma tela para selecionar um item em uma ListBox. Após selecionar o item desejado, ele retorna para tela anterior e o foco deveria ter ido para o campo, o Get. Porém o foco está ficando no botão que acaba impedindo o carregamento correto das informações na tela.

Alguém teve o mesmo problema?

Exemplo de como usamos o botão:

Redefine Get oCodiIte Var CodiIte ID 101 Of oDlgNfsInc Picture cMasIte When(lNewNfs_.And.Empty(CodiIte)) Valid(Empty(CodiIte).Or.((LocIte(@CodiIte,oDlgNfsInc,"vNFDesc",.T.,,,,,,@CodiBar).And.CarNfsInc(.F.,lNewNfs_,oDlgNfsInc)))) Bitmap "Lupa" Action(ProcIte(@CodiIte,@CodiBar,oCodiIte,oDlgNfsInc,.F.,"",.F.)) UpDate

Link to comment
Share on other sites

Camila

Bom dia

Utilizo esta função para SetFocus()

// nId: Id resource
// oDlg
//-----------------------------------------------------------------------------
FUNCTION FOCUS( nId, oDLG )

LOCAL I
FOR I = 1 TO LEN(oDLG:aControls)
    if nId=oDlg:aControls[i]:nId
       oDLG:aCONTROLS[I]:SETFOCUS()
       EXIT
    ENDIF
NEXT
RETURN.T.

Coloque no final do Action do botão de seleção:

Ex.: Focus(101,oDlgNfsInc)

Att

João Bosco

Link to comment
Share on other sites

Boa tarde,

Tentei como vocês me orientaram, porém nenhuma das soluções apresentadas resolveu o problema.

Um detalhe que notei é que se eu usar somente o teclado, com as teclas de atalho, o erro não é apresentado. E também que só ocorre quando uso a função When() ao criar o botão.

Então acredito que o problema esteja na função de click duplo do mouse utilizada pelo FiveWin.

Utilizo a função CreateButton da classe TGet:

METHOD CreateButton() CLASS TGet

   local oThis := Self
   local hBitmap
   local nBmpWidth := 1
   local lFileBmp := .t.

   if ValType( ::bAction ) == "B" .and. ::IsKindOf( "TGET" ) //Upper( ::ClassName() ) == "TGET"  // 2014-06-30
      if Empty( ::cBmpName )
         @ 0, ::nWidth - ::nHeight - If( ::lSpinner, 20, 0 ) BUTTONBMP ::oBtn OF Self ;
         ACTION ( Eval( oThis:bAction, oThis ), if( ::lKeepFocus, oThis:SetFocus(), nil ) ) ;
         SIZE ::nHeight - 4, ::nHeight - 4 PIXEL
         if Empty( ::oBtn:hBitmap )
            ::oBtn:SetText( "..." )
         endif
      else

         hBitmap   = If( ( lFileBmp := File( ::cBmpName ) ), ReadBitmap( 0, ::cBmpName ),;
                     LoadBitmap( GetResources(), ::cBmpName ) )

         if ::lAdjustBtn
            nBmpWidth := nBmpWidth( hBitmap ) + 5
            ::SetMargins( 1, nBmpWidth )
         else
            nBmpWidth := ::nHeight - 4
         endif

         if ::lBtnTransparent
            ::oBtn := TBtnBmp():New( 0, ::nWidth - nBmpWidth - If( ::lSpinner, 20, 4 ), nBmpWidth, ::nHeight - 4,;
            if ( !lFileBmp, ::cBmpName, ),,if ( lFileBmp, ::cBmpName, ),,{|| Eval( oThis:bAction, oThis ),oThis:SetFocus() },;
            Self,,,,,,,,,.f.)
            ::oBtn:lTransparent := ::lBtnTransparent
         else
            ::oBtn := TButtonBmp():New( 0, ::nWidth - nBmpWidth - If( ::lSpinner, 20, 4 ),, Self, {|| Eval( oThis:bAction, oThis ),oThis:SetFocus() }, ;
            nBmpWidth, ::nHeight - 4,,,,.t.,,,,,,,::cBmpName )
         endif

         DeleteObject( hBitmap )

      endif
      ::oBtn:lCancel = .T. // so the GET VALID is not fired when the button is focused

      if Upper( ::oWnd:ClassName() ) == "TDIALOG" .and. ::oWnd:lResize16
         ::oBtn:nWidth  = ::nHeight - 5
         ::oBtn:nHeight = ::nHeight - 5
         ::oBtn:nLeft   = ( ::nWidth * 1.167 ) - ::nHeight
      endif

      if ! IsAppThemed()
         ::oBtn:SetPos( 2, ::oBtn:nLeft + 2 )
      endif

      /*
      // We force a WM_NCCALCSIZE msg to be sent to the GET
      SetWindowPos( ::hWnd, 0, 0, 0, 0, 0,;
                    nOr( SWP_NOMOVE, SWP_NOSIZE, SWP_NOZORDER, SWP_FRAMECHANGED ) )
      */
   endif

return nil
Edited by CamilaFonseca
Link to comment
Share on other sites

Redefine Get oCodiIte Var CodiIte ID 101 Of oDlgNfsInc Picture cMasIte When(lNewNfs_.And.Empty(CodiIte)) Valid(Empty(CodiIte).Or.((LocIte(@CodiIte,oDlgNfsInc,"vNFDesc",.T.,,,,,,@CodiBar).And.CarNfsInc(.F.,lNewNfs_,oDlgNfsInc)))) Bitmap "Lupa" Action(ProcIte(@CodiIte,@CodiBar,oCodiIte,oDlgNfsInc,.F.,"",.F.)) UpDate


.

.

.


Function ProcIte(.....)

*

* Sua Rotina

*

oCodiIte:SetFocus()

oCodilte:VarPut( "o que vc quer atualizar na variavel" )

oCodilte:Refresh()

oCodilte:Display()

*

Return(...)
Link to comment
Share on other sites

Eu uso uma função que peguei aqui no fórum mesmo...

xsetfocus( oGet_X_ )

*-------------------------------------------*  
* 
* Define a Funcao xSetFocus que peguei do Fórum do FiveWin  
*
* DLP0032 09/11/2015 - 09:21:54  Dell 
*  
*----------------------------------------------------------*
FUNCTION xSetFocus( oObj )  
LOCAL oTempo := ""
*
Define Timer oTempo Interval 10 of oObj:oWnd;
Action ( oObj:SetFocus(), oObj:SetPos(0),oTempo:Deactivate())
Activate Timer oTempo
*
RETU("")

Com ela em vou e volto para qualquer get existente.

Espero que ajude!

Att.

Everton

Link to comment
Share on other sites

O bom de ser programador, não somente programador é que a gente entende as perguntas complicadas, por mais complexas que elas possam parecer. Alguns malucos cheios de faculdades, cursos disso e daquilo até tentam parecer que excedem o nosso entendimento e tentam nos superar, como se fossemos inferiores a eles!!!! Coitados desses doidos! Rsrsrsrs

NÓS PROGRAMADORES SOMOS OS SERES HUMANOS MAIS PODEROSOS DA FACE DA TERRA!

Link to comment
Share on other sites

O bom de ser programador, não somente programador é que a gente entende as perguntas complicadas, por mais complexas que elas possam parecer. Alguns malucos cheios de faculdades, cursos disso e daquilo até tentam parecer que excedem o nosso entendimento e tentam nos superar, como se fossemos inferiores a eles!!!! Coitados desses doidos! Rsrsrsrs

NÓS PROGRAMADORES SOMOS OS SERES HUMANOS MAIS PODEROSOS DA FACE DA TERRA!

Menos João... kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...