Colores de get desabilitado con estilo password falla
Posted: Tue Jun 18, 2024 6:00 pm
![Image](https://i.imgur.com/4dYoIkS.png)
Code: Select all | Expand
...
WITH OBJECT TGet()
:lDisColors := FALSE
:lClrFocus := TRUE
:nClrFocus := CLR_MENTA
:bColorBlock := <|oGet|
WITH OBJECT oGet
IF IsWindowEnabled( :hWnd ) .and. !:lReadOnly
IF :HasFocus
RETURN { CLR_BLACK, :nClrFocus }
ELSE
RETURN { CLR_BLUE, CLR_WHITE }
ENDIF
ENDIF
END
RETURN { CLR_BLACK, CLR_SOFTYELLOW }
>
END
//tGet():bColorBlock := { |oGet| IIf( oGet:lFocused, { CLR_BLACK, CLR_MENTA }, IIf( !oGet:lActive, { CLR_BLUE, CLR_SOFTYELLOW }, { CLR_BLACK, CLR_WHITE } ) ) }
...
Code: Select all | Expand
#define CLR_MENTA RGB( 221, 255, 238 )
#define CLR_SOFTYELLOW RGB( 255, 251, 225 )
#define CLR_MYCELESTE1 RGB( 074, 108, 154 )
#define CLR_MYCELESTE2 RGB( 191, 219, 255 )
...
lEdit := .f.
...
REDEFINE GET oSrv_Name VAR cSrv_Name ID 101 OF oDlg WHEN lEdit
REDEFINE GET oSrv_Data VAR cSrv_Data ID 102 OF oDlg WHEN lEdit
REDEFINE GET oSrv_User VAR cSrv_User ID 103 OF oDlg WHEN lEdit
REDEFINE GET oSrv_Pass VAR cSrv_Pass ID 104 OF oDlg WHEN lEdit
REDEFINE GET oSrv_Port VAR nSrv_Port ID 105 OF oDlg WHEN lEdit PICTURE "999999"
..
REDEFINE BUTTON oBtnTest;
ID 106 OF oDlg;
WHEN !lEdit;
ACTION MyTestConn()
...
FUNCTION MyEditConn()
lEdit := TRUE
oDlg:Refresh()
...
he intentado con estos dos codigos los cuales trabajan biendo, siempre y cuando el get no sea de tipo password, cuando es tipo password se muestra el el comun gray/blanco.
he intentado usar con el style ES_PASSWORD desde dialogo resource, o quitando ese estilo y usando la data oGet:lPassword := .T.
este es el codigo que controla eso en la clase tget, igualmente he intentado cambiarlo sin exito
method paint
Code: Select all | Expand
...
if IsWindowEnabled( ::hWnd ) .and. ! ::lReadOnly
if ::WinStyle( ES_READONLY )
::SendMsg( EM_SETREADONLY, 0 )
endif
CallWindowProc( ::nOldProc, ::hWnd, WM_PAINT, ::hDC, 0 )
elseif ::lPassword
if !::WinStyle( ES_READONLY )
::SendMsg( EM_SETREADONLY, 1 )
endif
CallWindowProc( ::nOldProc, ::hWnd, WM_PAINT, ::hDC, 0 )
else
if ::bColor == nil
if ::lDisColors
nClrT := GetSysColor( ::nClrGrayText )
nClrP := GetSysColor( COLOR_WINDOW )
SetTextColor( ::hDC, nClrT ) //GetSysColor( ::nClrGrayText )
SetBkColor( ::hDC, nClrP ) //GetSysColor( COLOR_WINDOW )
nClrBtnPane := GetSysColor( COLOR_WINDOW )
else
if ValType( ::nClrTextDis ) == "B"
nClrT := Eval( ::nClrTextDis )
SetTextColor( ::hDC, nClrT ) //Eval( ::nClrTextDis )
elseif ValType( ::nClrTextDis ) == "N"
if ::nClrTextDis >= 0
nClrT := ::nClrTextDis
SetTextColor( ::hDC, nClrT ) //::nClrTextDis
nClrBtnTxt := ::nClrTextDis
else
nClrT := ::nClrText
SetTextColor( ::hDC, nClrT ) //::nClrText
endif
endif
if ValType( ::nClrPaneDis ) == "B"
nClrP := Eval( ::nClrPaneDis )
SetBkColor( ::hDC, nClrP ) //Eval( ::nClrPaneDis )
elseif ValType( ::nClrPaneDis ) == "N"
if ::nClrPaneDis >= 0
nClrP := ::nClrPaneDis
SetBkColor( ::hDC, nClrP ) //::nClrPaneDis
nClrBtnPane := ::nClrPaneDis
else
nClrP := ::nClrPane
SetBkColor( ::hDC, nClrP ) //::nClrPane
endif
endif
endif
else
tmp := ::aColor //Eval( ::bColor, Self )
nClrT := tmp[ 1 ]
nClrP := tmp[ 2 ]
SetTextColor( ::hDC, nClrT ) //tmp[ 1 ]
SetBkColor( ::hDC, nClrP ) //tmp[ 2 ]
nClrBtnPane := tmp[ 2 ]
nClrBtnTxt := tmp[ 1 ]
ENDIF
...
Code: Select all | Expand
...
elseif ::lPassword
if !::WinStyle( ES_READONLY )
::SendMsg( EM_SETREADONLY, 1 )
endif
CallWindowProc( ::nOldProc, ::hWnd, WM_PAINT, ::hDC, 0 )
else
...