FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Colores del get en pantalla
Posts: 418
Joined: Wed Nov 26, 2008 06:33 PM
Colores del get en pantalla
Posted: Tue Nov 22, 2011 05:14 PM
Saludos

Tengo un problema con varios usuarios que por falta de buena vision no alcanzan a leer bien los gets en pantalla, los gets toman el color gris opcaco cuando no estan siendo editados o que son modo READONLY o el WHEN es falso.

Que podria hacer para que en general los gets tomen el color que yo defina en GET.... COLOR .....
aunque solamente los este desplegando y no editando.

Tengo esto:

oCtrl:SetColor(COLOR_NEGRO,COLOR_BLANCO) // no funciona, lo defino en cada get

y para ql que tiene el foco:

oCtrl:bGotFocus:={|oGet|oGet:SetColor(COLOR_NEGRO,if(oGet:cToolTip<>NIL,COLOR_SAMARILLO,COLOR_AMARILLO))
oCtrl:SetColorFocus(COLOR_AMARILLO)

[img][/c:\tmp\gets.bmp]
Noé Aburto Sánchez
Tec. Prog. de Sistemas. -Morelia, Mich. México.
fwh 20.06, Harbour 3.2.0, bcc 7.4
TsBrowse 9.0, TsButton 7.0, xEdit 6.1
naburtos@gmail.com, noeaburto67@hotmail.com
Posts: 694
Joined: Fri Oct 07, 2005 06:58 AM
Re: Colores del get en pantalla
Posted: Tue Nov 22, 2011 05:24 PM
Yo uso SetColor para cambiar el color de los get's desabilitados y me funciona bien.

Pero lo hago despues de definir la ventana
Code (fw): Select all Collapse
Activate Window oWnd
oGet:SetColor(


O en el On Init si es un diálogo
Code (fw): Select all Collapse
Activate Dialog oDlg On Init ( oGet:SetColor ...
Un saludo

Fernando González Diez

ALSIS Sistemas Informáticos
Posts: 418
Joined: Wed Nov 26, 2008 06:33 PM
Re: Colores del get en pantalla
Posted: Tue Nov 22, 2011 07:04 PM

Asunto resuelto.

La clase get maneja la varible :lDisColors que por inicio tien el valor .T., entonces lo que hago es

oGet:lDisColor:=.f.

ello obliga al get a tomar sel setcolor() los colores que le defino, de lo contrario hace esto:

SetTextColor(:nHD, GetSysColor(COLOR_GRAYTEXT))

Noé Aburto Sánchez
Tec. Prog. de Sistemas. -Morelia, Mich. México.
fwh 20.06, Harbour 3.2.0, bcc 7.4
TsBrowse 9.0, TsButton 7.0, xEdit 6.1
naburtos@gmail.com, noeaburto67@hotmail.com
Posts: 467
Joined: Fri Dec 09, 2005 12:41 AM
Re: Colores del get en pantalla
Posted: Tue Nov 22, 2011 07:28 PM
Hola Noe

En mi caso lo que hice fue cambiar la clase TGET agregando algunos cambios, de esa manera sin cambiar nada en los 1,700 Gets que tenia en mi sistema los Inhabilitados pasaban a tener un color mas legible, luego del cambio, ahora cada vez que compilo mi prg, adiciono el TGET.PRG, y listo, espero te sirva de algo :

1. Para poner color al Get inhabiitado cambie el metodo Paint()

Code (fw): Select all Collapse
//----------------------------------------------------------------------------//

METHOD Paint() CLASS TGet

   local aInfo := ::DispBegin()
   local hOldFont

   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
      ***===>>>>>>>>>>> ESTAS LINEAS DEL IF  FUERON ANULADAS PARA PONER COLOR A TODOS LOS GETS EN DISABLE
      *if ::lDisColors
      *   SetTextColor( ::hDC, GetSysColor( COLOR_GRAYTEXT ) )
      *   SetBkColor( ::hDC, GetSysColor( COLOR_WINDOW ) )
      *else
         ** Cambio de Colores cuando el Get esta deshablitidado  (lubin)
         SetTextColor( ::hDC,RGB(128,0,0)   )  &&  SetTextColor( ::hDC, ::nClrText )
         SetBkColor( ::hDC, RGB(234,238,242) )   && SetBkColor( ::hDC, ::nClrPane )
      *endif
      if ::oFont != nil
         hOldFont = SelectObject( ::hDC, ::oFont:hFont )
      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() }, GetWindowText( ::hWnd ) )
              else
                 ExtTextOut( ::hDC, 1, ( ::nWidth() - 3 ) / 2,;
                   { 0, 0, ::nHeight(), ::nWidth() }, GetWindowText( ::hWnd ) )
              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 ) )
              else
                 ExtTextOut( ::hDC, 1, ::nWidth() - 7,;
                    { 0, 0, ::nHeight(), ::nWidth() }, GetWindowText( ::hWnd ) )
              endif

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

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

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

   ::DispEnd( aInfo )

return 1
Posts: 1710
Joined: Tue Oct 28, 2008 06:26 PM
Re: Colores del get en pantalla
Posted: Tue Nov 22, 2011 10:35 PM
Noe
con esto le da color al get que tiene el focus
Code (fw): Select all Collapse
SetGetColorFocus(RGB(238,232,170))


Saludos,

Adhemar
Saludos,



Adhemar C.
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM
Re: Colores del get en pantalla
Posted: Tue Nov 22, 2011 11:56 PM
Hola

revisa el ejemplo testget3.prg

Code (fw): Select all Collapse
   oGet3:lDisColors      := .f.       // Deactive disable color
   oGet3:nClrTextDis     := CLR_WHITE // Color text disable status
   oGet3:nClrPaneDis     := CLR_BLUE  // Color Pane disable status

Continue the discussion