FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour GET cuando esta DISABLE se alinea mal.
Posts: 1956
Joined: Fri Oct 07, 2005 07:08 PM
GET cuando esta DISABLE se alinea mal.
Posted: Mon Sep 01, 2014 03:14 PM
Hola.
Tengo un get definido en el recurso para que se alinee a la derecha,
en el codigo voy mostrando una suma y si hago esto:
Code (fw): Select all Collapse
oGet:disable()

el valor se alinea a la izquierda, deja de estar alineado a la derecha.

Por qu'e?
gracias.
FWH 21.02
Harbour 3.2.0dev (r2104281802)
Copyright (c) 1999-2021, https://harbour.github.io/
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: GET cuando esta DISABLE se alinea mal.
Posted: Mon Sep 01, 2014 06:30 PM

Holá, hay algun problema con TGET.PRG, mira el tamaño del bitmap, ponga uno de 16x16 para ver.

En el recurso, ponga CENTER. No és el correcto, más...

Saludos.

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: GET cuando esta DISABLE se alinea mal.
Posted: Mon Sep 01, 2014 06:47 PM
Code (fw): Select all Collapse
METHOD Paint() CLASS TGet  // Antes..

   local aInfo := ::DispBegin()
   Local hOldFont

   //-> Mudan‡as Feitas em 22/12/2005 Por Antonio Linares
   //-> Para que o When(.F.) do GET, fique colorido normal. Muito bom. Joao.

   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 )

      //-> Para BTNGET.PRG Quando o RIGHT Esta ligado no WorkShop.exe
      //-> Modificado em 20/02/2008 - Por Joao Santos

      SetTextColor( ::hDC, ::nClrText ) 
      SetBkColor( ::hDC, ::nClrPane ) 
      hOldFont = SelectObject( ::hDC, ::oFont:hFont )

      do case 

         case lAnd( GetWindowLong( ::hWnd, GWL_STYLE ), ES_RIGHT )

              SetTextAlign( ::hDC, TA_RIGHT )

              ExtTextOut( ::hDC, 0, ::nWidth()  - 44,                        ;
              { 0, 0, ::nHeight(), ::nWidth() }, GetWindowText( ::hWnd ) )

      endcase

   else

      SetTextColor( ::hDC, ::nClrText ) 
      SetBkColor( ::hDC, ::nClrPane ) 
      hOldFont = SelectObject( ::hDC, ::oFont:hFont )
      
      do case 
         case lAnd( GetWindowLong( ::hWnd, GWL_STYLE ), ES_CENTER ) 
              SetTextAlign( ::hDC, TA_CENTER ) 
              ExtTextOut( ::hDC, 0, ::nWidth() / 2,                           ;
              { 0, 0, ::nHeight(), ::nWidth() }, GetWindowText( ::hWnd ) )
              
         case lAnd( GetWindowLong( ::hWnd, GWL_STYLE ), ES_RIGHT ) 
              SetTextAlign( ::hDC, TA_RIGHT ) 
              ExtTextOut( ::hDC, 0, ::nWidth() - 4,                           ;
              { 0, 0, ::nHeight(), ::nWidth() }, GetWindowText( ::hWnd ) )

         otherwise

              SetTextAlign( ::hDC, TA_LEFT )

              //-> Posicao do Get
              ExtTextOut( ::hDC, 0, 4,                                        ;
              { 0, 0, ::nHeight(), ::nWidth() }, GetWindowText( ::hWnd ) )
      endcase 

      SelectObject( ::hDC, hOldFont )

   endif

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

   ::DispEnd( aInfo )

return 1
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: GET cuando esta DISABLE se alinea mal.
Posted: Mon Sep 01, 2014 06:48 PM
Code (fw): Select all Collapse
METHOD Paint() CLASS TGet  // Despues de la version FWH13.06 - algo errado ahora.

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

   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 ) .and. ! ::lReadOnly
      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 )

      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() }, GetWindowText( ::hWnd ), ::nTxtStyle )
              else
                 ExtTextOut( ::hDC, 1, ( ::nWidth() - 3 ) / 2,;
                   { 0, 0, ::nHeight(), ::nWidth() }, GetWindowText( ::hWnd ), ::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() }, GetWindowText( ::hWnd ), ::nTxtStyle )
              else
                  if ValType( ::bAction ) == "B"
                      ExtTextOut( ::hDC, 1, ::nWidth() - 7 - ::nHeight,;
                    { 0, 0, ::nHeight(), ::nWidth() }, GetWindowText( ::hWnd ), ::nTxtStyle )
                 else
                    ExtTextOut( ::hDC, 1, ::nWidth() - 7 ,;
                    { 0, 0, ::nHeight(), ::nWidth() }, GetWindowText( ::hWnd ), ::nTxtStyle )
                  endif
              endif

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

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

      SetBkMode( ::hDC, nOldMode )

   endif


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

// button

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


  ::DispEnd( aInfo )

return 1
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: GET cuando esta DISABLE se alinea mal.
Posted: Mon Sep 01, 2014 07:23 PM
Mira donde escrebi: cambiado.

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

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

   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 ) .and. ! ::lReadOnly
      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 )

      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() }, GetWindowText( ::hWnd ), ::nTxtStyle )

              else

                 /* // Cambiado en: 01/09/2014
                 ExtTextOut( ::hDC, 1, ( ::nWidth() - 3 ) / 2,;
                   { 0, 0, ::nHeight(), ::nWidth() }, GetWindowText( ::hWnd ), ::nTxtStyle )

                 */

                 // Cambia aqui - se no es spinner - asi, funciona el WHEN( .F.)

                 ExtTextOut( ::hDC, 1, ( ::nWidth() - 44 ) / 2,;
                   { 0, 0, ::nHeight(), ::nWidth() }, GetWindowText( ::hWnd ), ::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() }, GetWindowText( ::hWnd ), ::nTxtStyle )

              else
                  if ValType( ::bAction ) == "B"
                      ExtTextOut( ::hDC, 1, ::nWidth() - 7 - ::nHeight,;
                    { 0, 0, ::nHeight(), ::nWidth() }, GetWindowText( ::hWnd ), ::nTxtStyle )


                 else
                    ExtTextOut( ::hDC, 1, ::nWidth() - 7 ,;
                    { 0, 0, ::nHeight(), ::nWidth() }, GetWindowText( ::hWnd ), ::nTxtStyle )


                  endif
              endif

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


      endcase

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

      SetBkMode( ::hDC, nOldMode )

   endif


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

// button

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


  ::DispEnd( aInfo )

return 1


Saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 1956
Joined: Fri Oct 07, 2005 07:08 PM
Re: GET cuando esta DISABLE se alinea mal.
Posted: Mon Sep 01, 2014 08:01 PM

gracias!

FWH 21.02
Harbour 3.2.0dev (r2104281802)
Copyright (c) 1999-2021, https://harbour.github.io/

Continue the discussion