how to use WCOLOR.CH Constant with MENU / COLORSELECT ?

how to use WCOLOR.CH Constant with MENU / COLORSELECT ?

Postby Jimmy » Fri Feb 17, 2023 10:25 am

hi,

i try to use COLOR_MENUHILIGHT
Code: Select all  Expand view
  COLORSELECT COLOR_MENUHILIGHT , COLOR_MENUHILIGHT , CLR_WHITE

this give be WHITE on BLACK :shock:

Code: Select all  Expand view
  COLORSELECT NumColor2RGB( COLOR_MENUHILIGHT ), NumColor2RGB( COLOR_MENUHILIGHT ), CLR_WHITE

FUNCTION NumColor2RGB( nColor )
RETURN aRetVal := { nRGBRed( nColor ), nRGBGreen( nColor ), nRGBBlue( nColor )

this give me a "light-Blue" Background but not what i expect

what is the right Way to use Constant of WCOLOR.CH for COLORSELECT :?:
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1725
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: how to use WCOLOR.CH Constant with MENU / COLORSELECT ?

Postby Jimmy » Sat Feb 18, 2023 8:41 am

hi,

got it :D

Code: Select all  Expand view
 COLORSELECT GetSysColor( COLOR_MENUHILIGHT ), GetSysColor( COLOR_MENUHILIGHT ) , GetSysColor( COLOR_MENU )

this will give Original Color of Windows OS for Menu
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1725
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: how to use WCOLOR.CH Constant with MENU / COLORSELECT ?

Postby cnavarro » Sat Feb 18, 2023 4:37 pm

Jimmy, very good

Code: Select all  Expand view

// Autor:  Cristobal Navarro
// Fecha:  18/06/2015
// Pruebas de Menus

#include "FiveWin.ch"
#include "wcolors.ch"

#define GWL_STYLE -16

#define SM_TABLETPC       86
#define SM_DIGITIZER      94
#define SM_MAXIMUMTOUCHES 95
#define SM_IMMENABLED     82

#define SM_CYMENUSIZE     55
//----------------------------------------------------------------------------//
static oWnd
static oMru1
static oMru2
Static cColorPan

Static oFontMenu

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

function Main()

   local oBar, oBar1, oBar2
   local cTitle, x
   Local cFont   := "Segoe UI Symbol"  //"Calibri"
   Local cFontH  := -14  //-16 //-20 //-18  //-14  //-10 //-12
   Local aFonts

   FW_SetUnicode( .T. )
   SetResDebug( .T. )

   if !IsWin8() .and. !IsWindows10()
      cFont   := "Calibri"
   endif

  DEFINE FONT oFontMenu NAME cFont SIZE 0, -14 WEIGHT 300

  cTitle := " Menus: " + if( !Empty( oFontMenu ), oFontMenu:cFaceName, "" ) +;
      if( !Empty( oFontMenu ), Str( oFontMenu:nHeight ), "" )

  DEFINE WINDOW oWnd FROM 3, 6 TO 20, 70 MDI ;
      TITLE cTitle MENU MBuildMenu( oWnd ) COLOR CLR_WHITE, CLR_WHITE //RGB( 116, 149, 193 )
  oWnd:SetFont( oFontMenu )

   SET MESSAGE OF oWnd TO "Prueba de Controles" FONT oFontMenu ;
       COLORS RGB( 10, 10, 10 ), CLR_WHITE ; //  , RGB( 116, 149, 193 ) ; //RGB( 31, 117, 70 ) ;
       NOINSET CLOCK DATE KEYBOARD NOBORDER 2015

   ACTIVATE WINDOW oWnd MAXIMIZED ON INIT MenuDlg( oWnd )

   //Hb_GCall(.t.)
   //CLEAR MEMORY

   While oFontMenu:nCount > 0
      oFontMenu:End()
   Enddo

   if File( "checkres.txt" )
      FErase( "checkres.txt" )
   endif
   CheckRes()

return nil

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

function MBuildMenu( oW )

   local oMenu
   local oMruConnections
   local oMruDBFs
   local cClrDegrIni, cClrDegrFin
   local cClrSelIni , cClrSelFin , cClrSelTxt, cClrSelBor
   local cClrMenu   , cClrMenuTxt

   DEFAULT oW  := oWnd

   cClrMenu    := CLR_RED
   cClrMenuTxt := CLR_WHITE
   cClrDegrFin := CLR_WHITE
   cClrDegrIni := CLR_WHITE
   cColorPan   := CLR_GRAY
   cClrSelFin  := CLR_HGRAY
   cClrSelIni  := CLR_HGRAY
   cClrSelTxt  := CLR_BLACK
   cClrSelBor  := CLR_GRAY
   MENU oMenu ;
      COLORMENU   RGB( 0, 0, 1 ), CLR_WHITE ;
      COLORRIGHT  CLR_WHITE, RGB( 0, 0, 1 );
      COLORLEFT   RGB( 0, 0, 1 ), CLR_WHITE ; //COLORBMP  CLR_WHITE, RGB( 0, 0, 1 );
      COLORSELECT GetSysColor( COLOR_MENUHILIGHT ), GetSysColor( COLOR_MENUHILIGHT ) , GetSysColor( COLOR_MENU ) ;
      ; //      COLORSELECT CLR_BLUE, CLR_WHITE, CLR_RED ;
      COLORSEPARATOR CLR_WHITE ;
      FONT oFontMenu NOBORDER 2013
      MENUITEM "NoClient"
      MENU
         MENUITEM "IsTablet" + "..." CHARICON 57696 //ACTION MsgInfo( IsTactil() )
         MENUITEM "Browse Properties NonClient" CHECKED //ACTION XBrowse(NonClient())
         MENUITEM FWString( "Sample MRU Recent files" ) CHARICON 57697
         MENU
            MRU oMruDBFs ;
               FILENAME GetEnv( "APPDATA" ) + "\FiveDBU.ini" ;
               SECTION  "Recent DBF files" ; //
               MESSAGE  FWString( "Open this file" ) ;
               SIZE     10
         ENDMENU

         SEPARATOR

         MENUITEM FWString( "Change Color BLUE" ) + "..."  CHARICON 57698

         MENUITEM FWString( "Sample MRU ADO connections" ) CHARICON 57699
         MENU
            MRU oMruConnections ;
               FILENAME GetEnv( "APPDATA" ) + "\FiveDBU.ini" ;    // .INI to manipulate
               SECTION  FWString( "Recent ADO connections strings" ) ;
               MESSAGE  FWString( "Connect to this ADO database" ) ;   // The message for all of them
               SIZE     10
         ENDMENU

         SEPARATOR

         MENUITEM FWString( "Change System Menu" ) + "..." ;
            ACTION MsgInfo("Prueba" ) CHARICON 57695

         SEPARATOR

         MENUITEM FWString( "Exit" ) ACTION oWnd:End() CHARICON 57694
      ENDMENU
      MENUITEM "Client"
      MENU
         MENUITEM "IsTablet" + "..." CHARICON 57696 //ACTION MsgInfo( IsTactil() )
         MENUITEM "Browse Properties NonClient" CHECKED //ACTION XBrowse(NonClient())
      ENDMENU
      oMenu:AddEdit()// { CLR_WHITE, CLR_BLACK, CLR_WHITE, CLR_WHITE, CLR_HGRAY, CLR_HGRAY, CLR_BLACK, CLR_GRAY } )
      oMenu:AddFile()// { CLR_YELLOW, CLR_BLACK, CLR_WHITE, CLR_WHITE, CLR_HGRAY, CLR_HGRAY, CLR_BLACK, CLR_GRAY } )
      oMenu:AddMdi()
      oMenu:AddHelp( "Pruebas Menus", "(c) Cristobal Navarro 2015" )
   ENDMENU

return oMenu

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

Function MenuDlg( oW )
Local oMenu
 
  REDEFINE SYSMENU oMenu OF oW FONT oFontMenu ;
     COLORSELECT  RGB( 51, 153, 255 ), RGB( 51, 153, 255 ), RGB( 0, 0, 0) ;
     COLORBMP RGB( 240, 240, 240 ), CLR_BLACK ;
     COLORRIGHT CLR_BLACK, RGB( 240, 240, 240 ) ;
     COLORSEPARATOR RGB( 200, 200, 200 ) 2013
     SEPARATOR
     MENUITEM "Primer Item" CHARICON 57605
     SEPARATOR
     MENUITEM "Segundo Item" ACTION MsgInfo( Len( oW:oSysMenu:aMenuitems ) ) CHARICON 57696
     MENUITEM "Tercer Item"  ACTION MsgInfo( Len( oW:oSysMenu:aMenuitems ) ) CHARICON 57736
     SEPARATOR
     MENUITEM "&Reset Menu"  ACTION oMenu:Reset()
   ENDSYSMENU

Return oMenu

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

 
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6541
Joined: Wed Feb 15, 2012 8:25 pm
Location: España


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 54 guests