Page 1 of 1

Colores del get en pantalla

PostPosted: Tue Nov 22, 2011 5:14 pm
by noe aburto
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]

Re: Colores del get en pantalla

PostPosted: Tue Nov 22, 2011 5:24 pm
by fgondi
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: Select all  Expand view
Activate Window oWnd
oGet:SetColor(


O en el On Init si es un diálogo
Code: Select all  Expand view
Activate Dialog oDlg On Init ( oGet:SetColor ...

Re: Colores del get en pantalla

PostPosted: Tue Nov 22, 2011 7:04 pm
by noe aburto
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))

Re: Colores del get en pantalla

PostPosted: Tue Nov 22, 2011 7:28 pm
by lubin
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: Select all  Expand view

//----------------------------------------------------------------------------//

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

 

Re: Colores del get en pantalla

PostPosted: Tue Nov 22, 2011 10:35 pm
by acuellar
Noe
con esto le da color al get que tiene el focus
Code: Select all  Expand view

SetGetColorFocus(RGB(238,232,170))
 


Saludos,

Adhemar

Re: Colores del get en pantalla

PostPosted: Tue Nov 22, 2011 11:56 pm
by Daniel Garcia-Gil
Hola

revisa el ejemplo testget3.prg

Code: Select all  Expand view
  oGet3:lDisColors      := .f.       // Deactive disable color
   oGet3:nClrTextDis     := CLR_WHITE // Color text disable status
   oGet3:nClrPaneDis     := CLR_BLUE  // Color Pane disable status