Page 1 of 1

color of the checkbox / radiobox

PostPosted: Tue Feb 15, 2022 12:42 pm
by Natter
Hi,

Is it possible to change the color of the checkbox / radiobox elements (not the text, but the icon itself) ?

Re: color of the checkbox / radiobox

PostPosted: Tue Feb 15, 2022 2:26 pm
by cmsoft
Prueba con
Code: Select all  Expand view

oRad:SetColor( nClrText, nClrPane )
oChk:SetColor( nClrText, nClrPane )

Re: color of the checkbox / radiobox

PostPosted: Tue Feb 15, 2022 3:24 pm
by Natter
In this case :setColor is not suitable - they can only change the background. I need to change the color of the element itself

Re: color of the checkbox / radiobox

PostPosted: Tue Feb 15, 2022 3:39 pm
by carlos vargas
if you use themes in the application, it is not possible

Re: color of the checkbox / radiobox

PostPosted: Tue Feb 15, 2022 8:18 pm
by karinha
Code: Select all  Expand view

FUNCTION...

   ...

   REDEFINE RADIO oRadMenu VAR nOpcaoRadio ID 201, 202 OF oDlg UPDATE        ;
      ON CHANGE( TROCA_INDICE( nOpcaoRadio, cAlias, oLbx ),                  ;
                 oLbx:GoTop(), oLbx:Refresh(), oLbx:SetFocus() )

   oRadMenu:SetFont( oFnt )

   oRadMenu:aItems[1]:cTooltip := "Por Nome    "
   oRadMenu:aItems[2]:cTooltip := "Por Codigo  "

   ACTIVATE DIALOG oDlg CENTERED ON INIT CTRLS_COLORS( oDlg )


RETURN NIL
// By Giovanny Vecchi
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
 


Regards, saludos.

Re: color of the checkbox / radiobox

PostPosted: Wed Feb 16, 2022 5:40 am
by Natter
Karinha, thank you!