FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Ribbon 2013 difiere el color de los tabs
Posts: 1344
Joined: Wed Nov 16, 2005 09:14 PM
Ribbon 2013 difiere el color de los tabs
Posted: Fri May 31, 2019 03:06 AM
Estimados:
Estoy creando mis menues con la clase Ribbon, y quiero utilizar el estilo 2013.
Como el menu es personalizable segun los permisos que tenga el usuario que accede, de antemano no se cuantos tabs va a tener, solo se que siempre va a tener el primer tab que se lo pone a todos los usuarios
Uso el siguiente codigo para crearlo
Code (fw): Select all Collapse
...
DEFINE RIBBONBAR oBar WINDOW oWnd PROMPT "Salir" HEIGHT 125 TOPMARGIN 25 2013 // Salir tiene un color
    
    oBar2 = TRBtn():New( 4, 0, 60, 20, "bitmaps\rbnmenu.bmp", { || llamametro()}, oBar,;
                         ,,,,,, .T., .T.,,,,,,, ,,,,,,,,,,,,, , nRGB( 125, 172, 215 ),;
                         nRGB( 65, 106, 189 ) ) 
    oApp:ancho:=oBar:nHeight
    ArmaBarra(oBar)
....
//**** Armo el menu
*******************************************************
** Armar la barra de botones
STATIC FUNCTION ArmaBarra(oBar)
DO WHILE !menu->(Eof())
   oBar:AddTab( ALLTRIM(menu->etiqueta))  //Los que agrego aca se ven con color
   menu->(DBSkip())
ENDDO
....


Que data puedo tocar para que los colores sean uniformes (o unos u otros)
Desde ya muchas gracias a todos.
Posts: 346
Joined: Mon Oct 05, 2009 03:35 PM
Re: Ribbon 2013 difiere el color de los tabs
Posted: Fri May 31, 2019 01:36 PM
hola, no se si te este tip te pueda ayudar pero quisas te pueda orientar :

yo modifique los métodos New, Paint y Painfld de la clase tribbonbar, cree un nuevo parámetro lWin10 para no tocar los originales en el archivo ribbon.ch

ribbon.ch

Code (fw): Select all Collapse
#xcommand DEFINE RIBBONBAR [ <oRBar> ] ;
                           [ <of:OF, WINDOW> <oWnd> ] ;
                           [ <prm: PROMPT, PROMPTS, ITEMS> <cPrompt,...> ] ;
                           [ <act: ACTION, EXECUTE, ON CHANGE> <uAction> ] ;
                           [ OPTION <nOption> ] ;
                           [ HEIGHT <nHeight> ] ;
                           [ TOPMARGIN <nTopMargin> ];
                           [ COLOR <nClrPane> ] ;
                           [ <ColorBox: COLORBOX> <nClrBoxOut>,<nClrBoxIn> ] ;
                           [ <ColorSel: COLORSEL> <nClrBoxSelOut>,<nClrBoxSelIn> ] ;
                           [ <l2010: 2010, _2010> ];
                           [ <l2013: 2013, _2013> ];
                           [ <lWIN10: WIN10, _WIN10> ];   <--- aqui
                           [ STARTBTN <nStart> ];
       => ;
          [<oRBar> := ] TRibbonBar():New( <oWnd>, [\{<cPrompt>\}], [{|nOption,nOldOption|<uAction>}], ;
             <nOption>, , <nHeight>, <nTopMargin>, <nClrPane>, <nClrBoxOut>, <nClrBoxIn>, <nClrBoxSelOut>, ;
             <nClrBoxSelIn>, , , , , <.l2010.>, <nStart>, <.l2013.>, <.lWIN10.> )  <--- aqui


modificaciones en la clase:

Code (fw): Select all Collapse
CLASS TRibbonBar FROM TControl
...
...
   DATA l2010, l2013, lWIN10
...
...
   METHOD New( oWnd, aPrompts, bAction, nOption,;
               nWidth, nHeight, nTopMargin, nClrPaneRB, nClrBoxOut, nClrBoxIn,;
               nClrBoxSelOut, nClrBoxSelIn, aGrad, aGradFld, aGradHigh, aGradOver, l2010, nStart, l2013, lWin10 ) CONSTRUCTOR

...
...
//--------------------------------------------------------------------//

METHOD New( oWnd, aPrompts, bAction, nOption,;
            nWidth, nHeight, nTopMargin, nClrPaneRB, nClrBoxOut, nClrBoxIn,;
            nClrBoxSelOut, nClrBoxSelIn, aGrad, aGradFld, aGradHigh, aGradOver, l2010,;
            nStart, l2013, lWin10 ) CLASS TRibbonBar
...
...
    ELSEIF l2013
        ...
        ...
    ELSEIF lWin10

           nTopMargin    := 25
           nClrPaneRB    := RGB(   0,  68, 118 )   // Panel de Fondo Trasero
           nClrBoxOut    := RGB(   0, 101, 184 )
           nClrBoxIn     := RGB(   0,  60, 108 )
           nClrBoxSelOut := RGB(   0, 101, 184 )
           nClrBoxSelIn  := RGB(   0,  88, 148 )
           aGrad         := { { 1, RGB(   0,  60, 108 ), RGB(   0,  46,  83 ) } }                                     // PANEL FRONTAL
           aGradFld      := {| nOpt | if( nOpt == ::nStart, { { 1, RGB(   0,  72, 161 ), RGB(   0, 146, 229 ) } },;
                                                { { 1, RGB(   0,  38,  83 ), RGB(   0,  60, 108 ) } } ) }
           aGradHigh     := { { 1, RGB(   0,  97, 145 ), RGB(   0, 111, 165 ) } }
           aGradOver     := { { 1, RGB(   0,  78, 138 ), RGB(   0,  64, 123 ) } }
...
...
   if l2010
      ::nLeftMargin   = 10
   elseif lWin10
      ::nLeftMargin   = 30
   else
      ::nLeftMargin   = 60
   endif
   ::lWin10       = lWin10
...
...
   for n = 1 to Len( ::aPrompts )
      oDlg := TRPanel():New( ::nTopMargin+1, 3, ::nBottom-5, ::nRight - ::nRightMargin - 3 , Self )
      oDlg:Hide()
      oDlg:lTransparent := .T.
      AAdd( ::aDialogs, oDlg )
      AAdd( ::aLeft, 0 )
      AAdd( ::aVisible, .T. )
      AAdd( ::aEnable, .T. )
      if ::l2013 .OR. ::lWin10
         AAdd( ::aClrTabTxt, { || RGB( 211, 213, 217 ) } ) // 160x3
      else
         AAdd( ::aClrTabTxt, { || CLRTEXT } )
      endif
   next

   ::oWnd:oTop := Self

   ::Default()

return self

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

METHOD Paint() CLASS TRibbonBar
...
...
   if ::oBackStage == NIL .OR. ! ::oBackStage:lVisible
      RoundBox( hDCMem, 1, nTop-1, aRect[ 4 ]+1, aRect[ 3 ] - 2,;
                If( ::l2013 .or. ::lWin10, 0, 7 ), If( ::l2013 .or. ::lWin10, 0, 7 ), ::nClrBoxOut )
      RoundBox( hDCMem, 2, nTop  , aRect[ 4 ], aRect[ 3 ] - 3, If( ::l2013 .or. ::lWin10, 0, 7 ),;
                If( ::l2013 .or. ::lWin10, 0, 7 ), ::nClrBoxIn )
   endif
...
...
return 0

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

METHOD PaintFld( nPrompt, hDCMem, nType )  CLASS TRibbonBar
...
...
   do case
      case nType == 1
         FillRect( hDCMem, { nRow - 2, nCol - 3, nRow + ::nHeightFld - 1,  nCol + ::aSizes[ nPrompt ] + 3 }, hBrush2 )
         GradientFill( hDCMem, nRow, nCol + 1, nRow + ::nHeightFld - 1, nCol +  ::aSizes[ nPrompt ], aGradFld )
         RoundBox( hDCMem, nCol - 1, nRow - 1,  nCol+::aSizes[ nPrompt ] + 1, nRow + ::nHeightFld + 3, If( ::l2013 .or. ::lWin10, 0, 7 ), If( ::l2013 .or. ::lWin10, 0, 7 ), ::nClrBoxOut )
         RoundBox( hDCMem, nCol, nRow,  nCol + ::aSizes[ nPrompt ], nRow + ::nHeightFld + 3,           If( ::l2013 .or. ::lWin10, 0, 7 ), If( ::l2013 .or. ::lWin10, 0, 7 ), ::nClrBoxIn )

      case nType == 2
         if ! ::l2010 .and. nPrompt != ::nStart
            GradientFill( hDCMem, nRow, nCol - 3, nRow + ::nHeightFld - 2, nCol +  ::aSizes[ nPrompt ] + 3, ::aGradHigh )
         endif
         GradientFill( hDCMem, nRow + 1, nCol, nRow + ::nHeightFld + 1, nCol +  ::aSizes[ nPrompt ], aGradFld )
         RoundBox( hDCMem, nCol - 1, nRow - 1,  nCol+::aSizes[ nPrompt ] + 1, nRow + ::nHeightFld + 3, If( ::l2013 .or. ::lWin10, 0, 7 ), If( ::l2013 .or. ::lWin10, 0, 7 ), ::nClrBoxSelOut )
         RoundBox( hDCMem, nCol, nRow,  nCol + ::aSizes[ nPrompt ], nRow + ::nHeightFld + 3,           If( ::l2013 .or. ::lWin10, 0, 7 ), If( ::l2013 .or. ::lWin10, 0, 7 ), ::nClrBoxSelIn )

      case nType == 3
         if ::aEnable[ nPrompt ]
            if ::l2010 .or. nPrompt == ::nStart
               GradientFill( hDCMem, nRow + 1, nCol, nRow + ::nHeightFld + 1,nCol +  ::aSizes[ nPrompt ], aGradFld )
             else
               GradientFill( hDCMem, nRow + 1, nCol, nRow + ::nHeightFld + 1,nCol +  ::aSizes[ nPrompt ], ::aGradOver )
            endif

            if nPrompt != ::nStart
               RoundBox( hDCMem, nCol - 1, nRow - 1,  nCol+::aSizes[ nPrompt ] + 1, nRow + ::nHeightFld + 3, If( ::l2013 .or. ::lWin10, 0, 7 ), If( ::l2013 .or. ::lWin10, 0, 7 ), ::nClrBoxOut )
               RoundBox( hDCMem, nCol, nRow,  nCol + ::aSizes[ nPrompt ], nRow + ::nHeightFld + 3, If( ::l2013 .or. ::lWin10, 0, 7 ), If( ::l2013 .or. ::lWin10, 0, 7 ), ::nClrBoxIn )
            else
               RoundBox( hDCMem, nCol - 1, nRow ,  nCol+::aSizes[ nPrompt ] + 1, nRow + ::nHeightFld + 3, If( ::l2013 .or. ::lWin10, 0, 7 ), If( ::l2013 .or. ::lWin10, 0, 7 ), ::nClrBoxOut )
            endif

         else
            FillRect( hDCMem, { nRow - 2, nCol - 2, nRow + ::nHeightFld - 1,  nCol + ::aSizes[ nPrompt ] + 2 }, hBrush2 )
         endif

      case nType == 4 // unselect
         if nPrompt == ::nStart
            GradientFill( hDCMem, nRow + 1, nCol, nRow + ::nHeightFld + 1,nCol +  ::aSizes[ nPrompt ], aGradFld )
            RoundBox( hDCMem, nCol - 1, nRow ,  nCol+::aSizes[ nPrompt ] + 1, nRow + ::nHeightFld + 3, If( ::l2013 .or. ::lWin10, 0, 7 ), If( ::l2013 .or. ::lWin10, 0, 7 ), ::nClrBoxOut )
            FillRect( hDCMem, { nRow + ::nHeightFld - 1, nCol - 1, nRow + ::nHeightFld + 3, nCol + ::aSizes[ nPrompt ] + 1 }, hBrush3 )
         else
            FillRect( hDCMem, { nRow - 2, nCol - 2, nRow + ::nHeightFld - 1,  nCol + ::aSizes[ nPrompt ] + 2 }, hBrush2 )
            FillRect( hDCMem, { nRow + ::nHeightFld - 1, nCol - 2, nRow + ::nHeightFld - 1,  nCol + ::aSizes[ nPrompt ] + 2 }, hBrush4 )
         endif
   endcase
...
...

return 0

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


Resultado




solo espero que te sirva.

Saludos
SkyPe: armando.lagunas@hotmail.com

Mail: armando.lagunas@gmail.com
Posts: 1344
Joined: Wed Nov 16, 2005 09:14 PM
Re: Ribbon 2013 difiere el color de los tabs
Posted: Fri May 31, 2019 10:19 PM

Hola Armando, gracias por tomarte el timepo para contestar.
Aplique los cambios que sugieres, y aunque me toma tu nuevo estilo y el degrades al pasar el mouse, el problema de colores entre los tabs creados con el define y con addtab persiste, me sigue mostrando colores diferentes en el color de las letras.
Tengo la siguente version de harbour y fivewin
Compiler version: Harbour 3.2.0dev (r1601050904)
FiveWin Version: FWH 16.06

Posts: 346
Joined: Mon Oct 05, 2009 03:35 PM
Re: Ribbon 2013 difiere el color de los tabs
Posted: Mon Jun 03, 2019 02:48 PM
mmm, revisando:

Code (fw): Select all Collapse
...
...
#define CLRTEXT             RGB(  21,  66, 139 )
#define CLRTEXTBACK         RGB( 113, 106, 183 )
...
...

METHOD New(...)

   for n = 1 to Len( ::aPrompts )
      oDlg := TRPanel():New( ::nTopMargin+1, 3, ::nBottom-5, ::nRight - ::nRightMargin - 3 , Self )
      oDlg:Hide()
      oDlg:lTransparent := .T.
      AAdd( ::aDialogs, oDlg )
      AAdd( ::aLeft, 0 )
      AAdd( ::aVisible, .T. )
      AAdd( ::aEnable, .T. )
      if ::l2013 .OR. ::lWin10
         AAdd( ::aClrTabTxt, { || RGB( 211, 213, 217 ) } ) // 160x3       <--- aqui puede ser
      else
         AAdd( ::aClrTabTxt, { || CLRTEXT } )
      endif
   next


pueda que donde puse la marca este lo que necesitas, encontré que en ese punto esta la definición del color de las letras en las pestañas de la ribbon, intenta por tu lado, yo buscare cambiar el color por mi lado, si encuentro solución la publico.

Saludos
SkyPe: armando.lagunas@hotmail.com

Mail: armando.lagunas@gmail.com
Posts: 1344
Joined: Wed Nov 16, 2005 09:14 PM
Re: Ribbon 2013 difiere el color de los tabs
Posted: Mon Jun 03, 2019 07:57 PM

Gracias Armando por volver a responder.
Con este cambio, lo que resulta es que el tab que creo con el DEFINE queda en blanco tanto al tener el foco como cuando no lo tiene. Y viceversa (los otros siempre mantienen el color negro).

Continue the discussion