Asi, funciona maestro Navarro. Ahora, COMPLETO.
Code: Select all
// Radio Buttons management sample - \SAMPLES\TESTRAD.PRG
#include "FiveWin.ch"
#include "Colores.ch"
//----------------------------------------------------------------------------//
function Main()
local oDlg, oRadMenu, oBrush, oFont
local nOption := 2
local nDTxtColor := 192
SET _3DLOOK ON
DEFINE FONT oFont NAME 'Arial' SIZE 0, -12
DEFINE DIALOG oDlg RESOURCE "Radios"
REDEFINE RADIO oRadMenu VAR nOption ID 110, 120, 130, 140, 150 OF oDlg ;
ON CHANGE MsgBeep()
AEval( oRadMenu:aItems, { | oRadMenu | oRadMenu:lTransparent := .T., ;
oRadMenu:SetFont( oFont ), ;
oRadMenu:nClrText := nDTxtColor } )
REDEFINE BUTTON ID 100 OF oDlg ACTION oRadMenu:GoNext() ;
WHEN nOption == 3
REDEFINE BUTTON ID 102 OF oDlg ACTION oRadMenu:GoPrev()
// Asi, funciona maestro Navarro.
// By: Giovany Vecchi:
// http://fivewin.com.br/index.php?/topic/28678-colores-no-radio-n%C3%A3o-funciona/
ACTIVATE DIALOG oDlg CENTERED ON INIT( CTRLS_COLORS( oDlg ), ;
oRadMenu:aItems[ 1 ]:SetText( "Hello" ) )
/* // no funciona
ON INIT( ChangeColors( oRadMenu ), ;
oRadMenu:aItems[ 1 ]:SetText( "Hello" ) )
*/
// ON INIT oRadMenu:aItems[ 1 ]:SetText( "Hello" )
SET _3DLOOK OFF
return nil
// By: Giovany Vecchy. www.fivewin.com.br
FUNCTION CTRLS_COLORS( f_oDlgContainer )
LOCAL lc_aCtrls := {}, lc_iFor := 0
LOCAL lc_aItemsRadio := {}
lc_aCtrls := f_oDlgContainer:aControls
FOR lc_iFor := 1 TO Len( lc_aCtrls )
IF ValType( lc_aCtrls[lc_iFor] ) == "O"
IF lc_aCtrls[lc_iFor]:ClassName() == "TRADIO"
aEval( lc_aCtrls[lc_iFor]:oRadMenu:aItems, ;
{|_oRadId|{ SetWindowTheme( _oRadId:hWnd, "", "" ), ;
_oRadId:SetColor( CLR_CYAN, CLR_WHITE ) } } )
ELSEIF lc_aCtrls[lc_iFor]:ClassName() == "TCHECKBOX"
SetWindowTheme( lc_aCtrls[lc_iFor]:hWnd, "", "" )
lc_aCtrls[lc_iFor]:SetColor( G_COLOR_SYS( 31 ), G_COLOR_SYS( 1 ) )
ENDIF
ENDIF
NEXT
RETURN NIL
/*
Joao,
Tienes que hacerlo desde la claúsula ON INIT del diálogo:
ACTIVATE DIALOG oDlgInd ON INIT ChangeColors( oRadMenu )
...
*/
FUNCTION ChangeColors( oRadMenu )
oRadMenu:aItems[1]:SetColor( CLR_CYAN, CLR_WHITE )
oRadMenu:aItems[2]:SetColor( CLR_CYAN, CLR_WHITE )
oRadMenu:aItems[3]:SetColor( CLR_CYAN, CLR_WHITE )
oRadMenu:aItems[4]:SetColor( CLR_CYAN, CLR_WHITE )
oRadMenu:aItems[5]:SetColor( CLR_CYAN, CLR_WHITE )
RETURN( .T. )
/*
regards, saludos
Antonio Linares
www.fivetechsoft.com
*/
//----------------------------------------------------------------------------//
procedure AppSys // XBase++ requirement
return
//----------------------------------------------------------------------------//
FUNCTION G_COLOR_SYS( f_nTpObj )
LOCAL cColorRet := nRgb( 0, 0, 0 )
LOCAL nColorFundo := nRgb( 255, 255, 255 ), ;
nColorStaticText := nRgb( 255, 255, 255 ), ;
nColorTxtBtnNormal := nRgb( 255, 255, 255 ), ;
nColorTxtBtnOver := nRgb( 255, 255, 255 ) , ;
nColorTxtBtnDisable := CLR_CYAN
LOCAL nColorTxtRadioCheckBox := CLR_WHITE
LOCAL nTheme := 1
DEFAULT f_nTpObj := 1 // 1-Fundo
// 2-Static Text
// 3-Say Text caracter
// 4-Say Fundo
IF nTheme == 1 // escuro medio
nColorFundo := nRgb( 111, 141, 160 ) // ta usando 01
// nColorFundo := nRgb(45,54,76) // ta usando
// nColorFundo := CLR_VSTIT
nColorStaticText := nRgb( 255, 255, 255 ) // 02
nColorTxtBtnNormal := nRgb( 255, 255, 255 )
nColorTxtBtnOver := CLR_WHITE //nRgb(255,255,255)
nColorTxtBtnDisable := CLR_HGRAY
nColorTxtRadioCheckBox := METRO_AZUL6
ELSEIF nTheme == 2 // windows 10 2019
nColorFundo := CLR_VSWIN
nColorStaticText := nRgb( 0, 0, 0 )
nColorTxtBtnNormal := nRgb( 0, 0, 0 )
nColorTxtBtnOver := nRgb( 0, 0, 0 )
nColorTxtBtnDisable := CLR_CYAN
nColorTxtRadioCheckBox := METRO_AZUL6
ENDIF
IF f_nTpObj == 1 // Fundo
cColorRet := nRgb( 121, 151, 170 ) // ta usando
// cColorRet := nRgb(53,63,89) // Avast 01
// cColorRet := nRgb(45,54,76) // Avast 02
cColorRet := nColorFundo
ELSEIF f_nTpObj == 2 // Static Text
cColorRet := nColorStaticText // nRgb(255,255,255)
ELSEIF f_nTpObj == 3 // Say Text caracter
cColorRet := nRgb( 0, 0, 0 )
ELSEIF f_nTpObj == 4 // Say Fundo
cColorRet := METRO_AZUL14 ///nRgb(0,0,0)
ELSEIF f_nTpObj == 10 // Buttom Fundo normal
cColorRet := { { 100,nColorFundo,nColorFundo } } //nRgb(121,151,170) // Este é igual o fundo de tela
// cColorRet := {{0.3,nRgb(05,05,05),nRgb(71,71,71)},;
// {0.7,nRgb(61,61,61),nRgb(0,0,0)} }
ELSEIF f_nTpObj == 11 // Buttom Fundo Over mouse
cColorRet := { { 100,SetBrightColor( nColorFundo,18 ),;
SetBrightColor( nColorFundo, 18 ) } } //nRgb(121,151,170) // Este é igual o fundo de tela
ELSEIF f_nTpObj == 12 // Buttom Fundo disable
cColorRet := { { 100,nColorFundo,nColorFundo } } //nRgb(121,151,170) // Este é igual o fundo de tela
ELSEIF f_nTpObj == 13 // Buttom Texto Normal
cColorRet := nColorTxtBtnNormal
ELSEIF f_nTpObj == 14 // Buttom Texto OVER
cColorRet := nColorTxtBtnOver
ELSEIF f_nTpObj == 15 // Buttom Texto Disable
cColorRet := nColorTxtBtnDisable
ELSEIF f_nTpObj == 16 // Buttom Border Normal
cColorRet := nColorTxtBtnNormal //nRgb(255,255,255)
ELSEIF f_nTpObj == 17 // Buttom Border over
cColorRet := nColorTxtBtnOver //nRgb(255,255,255)
ELSEIF f_nTpObj == 31 // Radio ou CheckBox
cColorRet := nColorTxtRadioCheckBox
ENDIF
RETURN cColorRet
FUNCTION SetBrightColor( f_nColorRgb, f_nPercent )
LOCAL nColorRgbReturn := 0
LOCAL nRgbRed, nRgbGreen, nRgbBlue
nRgbRed := nRgbRed( f_nColorRgb )
nRgbGreen := nRgbGreen( f_nColorRgb )
nRgbBlue := nRgbBlue( f_nColorRgb )
IF nRgbRed > 0
nRgbRed := Int( nRgbRed + ( (nRgbRed/100 ) * f_nPercent ) )
IF nRgbRed > 255
nRgbRed := 255
ENDIF
ENDIF
IF nRgbGreen > 0
nRgbGreen := Int( nRgbGreen + ( (nRgbGreen/100 ) * f_nPercent ) )
IF nRgbGreen > 255
nRgbGreen := 255
ENDIF
ENDIF
IF nRgbBlue > 0
nRgbBlue := Int( nRgbBlue + ( (nRgbBlue/100 ) * f_nPercent ) )
IF nRgbBlue > 255
nRgbBlue := 255
ENDIF
ENDIF
nColorRgbReturn := nRgb( nRgbRed, nRgbGreen, nRgbBlue )
RETURN nColorRgbReturn
// Muchas gracias, many thanks, obrigado, Giovany Vecchi. www.fivewin.com.br
Regards, saludos.