lKeepFocus clase tGet

lKeepFocus clase tGet

Postby Marcelo Via Giglio » Sun Feb 16, 2014 5:27 pm

Buenas tardes,

la DATA lKeepFocus no está utilizada en todos los llamados al bloque bAction de la clase GET, el método CreateButton
deberia quedar así:

Code: Select all  Expand view  RUN
METHOD CreateButton() CLASS TGet

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

   if ValType( ::bAction ) == "B" .and. Upper( ::ClassName() ) == "TGET"
      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 ),if( ::lKeepFocus, oThis:SetFocus(), nil ) },;
            Self,,,,,,,,,.f.)
            ::oBtn:lTransparent := ::lBtnTransparent
         else
            ::oBtn := TButtonBmp():New( 0, ::nWidth - nBmpWidth - If( ::lSpinner, 20, 4 ),, Self, {|| Eval( oThis:bAction, oThis ),if( ::lKeepFocus, oThis:SetFocus(), nil ) }, ;
            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

      /*
      // 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


Saludos

Marcelo
Marcelo Via Giglio
 
Posts: 1065
Joined: Fri Oct 07, 2005 3:33 pm
Location: Cochabamba - Bolivia

Return to Bugs report & fixes / Informe de errores y arreglos

Who is online

Users browsing this forum: No registered users and 10 guests