FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour soporte de @L en tget de fwh (relleno de cero)
Posts: 1789
Joined: Tue Oct 11, 2005 05:01 PM
soporte de @L en tget de fwh (relleno de cero)
Posted: Mon Oct 03, 2011 02:06 PM
Antonio, mira est modificacion a la clase tget en el metodo paint para brindar soporte de @L (relleno de cero) para valores numericos

Code (fw): Select all Collapse
?transform( 1256. "@L 999999" )   //001256

redefine get nVar id 101 of oDlg picture "@L 999999"


Code (fw): Select all Collapse
METHOD Paint() CLASS TGet

   local aInfo := ::DispBegin()
   local hOldFont
   local nClrBtnTxt, nClrBtnPane
   local nOldMode
   local cText

   nClrBtnTxt  := ::nClrText
   nClrBtnPane := ::nClrPane

   if ::oBrush != nil
      FillRect( ::hDC, GetClientRect( ::hWnd ), ::oBrush:hBrush )
   else
      CallWindowProc( ::nOldProc, ::hWnd, WM_ERASEBKGND, ::hDC, 0 )
   endif

   if IsWindowEnabled( ::hWnd )
      CallWindowProc( ::nOldProc, ::hWnd, WM_PAINT, ::hDC, 0 )
   else
      if ::lDisColors
         SetTextColor( ::hDC, GetSysColor( COLOR_GRAYTEXT ) )
         SetBkColor( ::hDC, GetSysColor( COLOR_WINDOW ) )
         nClrBtnPane := GetSysColor( COLOR_WINDOW )
      else
         if ValType( ::nClrTextDis ) == "B"
            SetTextColor( ::hDC, Eval( ::nClrTextDis ) )
         elseif ValType( ::nClrTextDis ) == "N"
            if ::nClrTextDis >= 0
                SetTextColor( ::hDC, ::nClrTextDis  )
                nClrBtnTxt := ::nClrTextDis
            else
                SetTextColor( ::hDC, ::nClrText )
            endif
         endif

         if ValType( ::nClrPaneDis ) == "B"
            SetBkColor( ::hDC, Eval( ::nClrPaneDis ) )
         elseif ValType( ::nClrPaneDis ) == "N"
            if ::nClrPaneDis >= 0
               SetBkColor( ::hDC, ::nClrPaneDis  )
               nClrBtnPane := ::nClrPaneDis
            else
               SetBkColor( ::hDC, ::nClrPane )
            endif
         endif
      endif

      if ::oFont != nil
         hOldFont = SelectObject( ::hDC, ::oFont:hFont )
      endif

      nOldMode = SetBkMode( ::hDC, TRANSPARENT )

      cText := GetWindowText( ::hWnd )

      if !Empty( ::cPicture ) .and. "L" $ ::cPicture .and. ::oGet:Type == "N"
         cText := Transform( Val( cText ), ::cPicture )
      endif

      do case
         case lAnd( GetWindowLong( ::hWnd, GWL_STYLE ), ES_CENTER )
              SetTextAlign( ::hDC, TA_CENTER )
              if ::lSpinner
                 ExtTextOut( ::hDC, 1, ( ::nWidth() - 3 - GetSysMetrics( SM_CYHSCROLL ) ) / 2,;
                    { 0, 0, ::nHeight(), ::nWidth() }, cText, ::nTxtStyle )
              else
                 ExtTextOut( ::hDC, 1, ( ::nWidth() - 3 ) / 2,;
                   { 0, 0, ::nHeight(), ::nWidth() }, cText, ::nTxtStyle )
              endif

                 case lAnd( GetWindowLong( ::hWnd, GWL_STYLE ), ES_RIGHT )
              SetTextAlign( ::hDC, TA_RIGHT )
              if ::lSpinner
                 ExtTextOut( ::hDC, 1, ::nWidth() - 7 - GetSysMetrics( SM_CYHSCROLL ),;
                    { 0, 0, ::nHeight(), ::nWidth() }, cText, ::nTxtStyle )
              else
                  if ValType( ::bAction ) == "B"
                      ExtTextOut( ::hDC, 1, ::nWidth() - 7 - ::nHeight,;
                    { 0, 0, ::nHeight(), ::nWidth() }, cText, ::nTxtStyle )
                 else
                    ExtTextOut( ::hDC, 1, ::nWidth() - 7 ,;
                    { 0, 0, ::nHeight(), ::nWidth() }, cText, ::nTxtStyle )
                  endif
              endif

         otherwise
              SetTextAlign( ::hDC, TA_LEFT )
              ExtTextOut( ::hDC, 1, 2,;
                { 0, 0, ::nHeight(), ::nWidth() }, cText, ::nTxtStyle )
      endcase

      if ::oFont != nil
         SelectObject( ::hDC, hOldFont )
      endif

      SetBkMode( ::hDC, nOldMode )

   endif

   if ValType( ::bPainted ) == "B"
      Eval( ::bPainted, ::hDC, ::cPS, Self )
   endif

   if ::oBtn != nil .and. ::lBtnTransparent
     ::oBtn:SetColor( nClrBtnTxt, nClrBtnPane )
   endif

  ::DispEnd( aInfo )

return 1


salu2
carlos vargas
Salu2

Carlos Vargas

Desde Managua, Nicaragua (CA)

Continue the discussion