FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Questions to MENU
Posts: 1048
Joined: Mon Oct 24, 2005 09:54 AM
Questions to MENU
Posted: Tue Mar 15, 2016 05:59 PM
1. I found, that the 3. parameter (textcolor) from COLORSELECT only accepted, if in the COLORMENU the textcolor is CLR_BLACK! Please try:
Code (fw): Select all Collapse
COLORMENU CLR_RED,CLR_WHITE COLORSELECT CLR_BLACK,CLR_RED,CLR_HGREEN

2. Another question to the parameters from COLORSELECT: Whats the meaning from the first parameter?
3. On the top-menu the selected items i cannot change the colors!

Is a documentation for all options from this class?
Regards,
Günther
---------------------------------
office@byte-one.com
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Questions to MENU
Posted: Tue Mar 15, 2016 06:26 PM
Günther, excuse my poor English
Please, in the following example, tell me your questions and doubts ( Menu0002.prg and menu0002.rc )
Code (fw): Select all Collapse
// Autor:  Cristobal Navarro
// Fecha:  01/01/2016
// Pruebas de Menus
//

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

//----------------------------------------------------------------------------//
static oWnd
static oMru1
static oMru2
Static cColorPan
Static oFontMenu

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

function Main()

   local oBar, oBar1, oBar2
   local cTitle, x
   Local cFont   := "Segoe UI Symbol" // SemiBold"  //"Calibri"
   Local cFontH  := -14  
   Local aFonts

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

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

  DEFINE FONT oFontMenu NAME cFont SIZE 0, cFontH WEIGHT 300

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

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

   ACTIVATE WINDOW oWnd MAXIMIZED
   
   if !Empty( oFontMenu )
      While oFontMenu:nCount > 0
         oFontMenu:End()
      Enddo
   endif

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

return nil

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

Function BuildMenu( oW )

   Local oMenu
   Local oMnu
   Local oGraba
   Local cPrompt := "                              "

   DEFAULT oW    := oWnd

   MENU oMenu 2015 FONT oFontMenu

      MENUITEM  FILE "..\bitmaps\menu4.bmp"
      MENU
         MENUITEM "&Nuevo" CHECKED
         MENUITEM "&Open"  CHARICON "A" ITALIC
         SEPARATOR
         MENUITEM "&1.- Item 1"     RESOURCE "icon"  DISABLED
         MENUITEM "&2.- Item 2"     CHARICON 58020 COLORRIGHT CLR_YELLOW
         MENUITEM "&3.- Item 3"     CHARICON 57696 BOLD ITALIC
         MENUITEM "&4.- Item 4"     CHARICON 57756 COLORRIGHT CLR_HRED
         MENUITEM "&5.- Item 5"     CHARICON 57736 COLORRIGHT CLR_MAGENTA
      ENDMENU
      
      MENUITEM "&Archivos" COLORMENU CLR_BLUE ITALIC
      MENU
         MENUITEM "&Nuevo item Mru" CHECKED
         //SEPARATOR
         MENUITEM SEPARATOR FILE "..\bitmaps\menu4.bmp"
         //SEPARATOR
         MENUITEM "&Files  " COLORRIGHT CLR_HBLUE
         MENU
            MENUITEM "&Nuevo" CHECK
            MENUITEM "&Open"  CHARICON "A" ITALIC
            MENUITEM SEPARATOR RESOURCE "Menu4"
            MENUITEM "&Nuevo proceso" CHARICON "P" RIGHTCOLOR CLR_HRED BOLD
         ENDMENU
         MENUITEM "&New    " CHARICON 57696 
         MENUITEM "&Child  " RESOURCE "new" BOLD
         SEPARATOR         
         MENUITEM "&Salir" ACTION oWnd:End() COLORRIGHT CLR_HRED BOLD ITALIC
      ENDMENU

      MENUITEM "E&ditar" COLORMENU CLR_RED BOLD
      MENU
         MENUITEM "&Nuevo" CHECKED
         MENUITEM "&Open"  CHARICON "A" ITALIC
         SEPARATOR
         MENUITEM "&PPPPPPPP" SEPARATOR FILE "..\bitmaps\yellow.bmp"
         SEPARATOR
         MENUITEM "&1.- Item 1"     RESOURCE "icon"  DISABLED
         MENUITEM "&2.- Item 2"     CHARICON 58020 COLORRIGHT CLR_YELLOW
         MENUITEM "&3.- Item 3"     CHARICON 57696 BOLD ITALIC
         MENUITEM "&4.- Item 4"     CHARICON 57756 COLORRIGHT CLR_HRED
         MENUITEM "&5.- Item 5"     CHARICON 57736 COLORRIGHT CLR_MAGENTA
         SEPARATOR
         MENUITEM "&Grabar como." CHARICON 57605
         SEPARATOR
         MENUITEM FILE "..\bitmaps\yellow.bmp"
      ENDMENU
      
      MENUITEM "&Buscar" COLORMENU CLR_GREEN
      MENU
         MENUITEM "&Nuevo"  CHECKED
         MENUITEM "&PPPPPPPP" SEPARATOR FILE "..\bitmaps\yellow.bmp"
         MENUITEM "&Open"   CHARICON "A"
         SEPARATOR
         MENUITEM "Uno"     RESOURCE "icon"  DISABLED
         MENUITEM "Dos"     WHEN .F. CHARICON 58020
         MENUITEM "* SEPARATOR" + CRLF + "- Linea 2   "      SEPARATOR COLORRIGHT CLR_HBLUE
         MENUITEM "Tres"    CHARICON 57696 COLORRIGHT CLR_GREEN
         MENUITEM "Cuatro"  CHARICON 57756 BOLD
         MENUITEM "Cinco"   CHARICON 57736 BOLD ITALIC
         SEPARATOR
         MENUITEM "&Grabar como." CHARICON 57605
         MENUITEM FILE "..\bitmaps\yellow.bmp"
      ENDMENU

      MENUITEM "&Modificar" COLORMENU CLR_BROWN  BOLD ITALIC
      MENU
         MENUITEM "&Nuevo proceso" CHARICON "P"
         SEPARATOR
         MENUITEM "&Abrir" + CRLF + "Linea 2"  CHARICON "W" COLORRIGHT CLR_BLUE BOLD
         MENUITEM "&Nuevo"         CHECKED  DISABLED
         MENUITEM "SEPARATOR" + CRLF + "Linea 2"      SEPARATOR BOLD ITALIC COLORRIGHT CLR_HRED
         MENUITEM "&Grabar como."  RESOURCE "icon"
      ENDMENU

      //oMenu:AddEdit()
      //oMenu:AddMdi()
      oMenu:AddFile()      
      oMenu:AddHelp( "FiveWin Menus", "FiveTech 1993-2015" )
   ENDMENU

Return oMenu

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


File .rc
Code (fw): Select all Collapse
#include <windows.h>
#include <commctrl.h>

New    BITMAP "..//bitmaps/16x16/new.bmp"
Dialog BITMAP "..//bitmaps/16x16/form.bmp"
Open   BITMAP "..//bitmaps/16x16/open.bmp"
Save   BITMAP "..//bitmaps/16x16/floppy.bmp"
Exit   BITMAP "..//bitmaps/16x16/exit.bmp"
Menu4  BITMAP "..//bitmaps/menu4.bmp"
icon   BITMAP "..//bitmaps/16x16/icon.bmp"



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
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Questions to MENU
Posted: Tue Mar 15, 2016 06:39 PM
Simple sample

Code (fw): Select all Collapse
#include "Fivewin.ch"

Static oWnd
Static oFnt
Static aMisItems
Static oSay1

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

Function Main()

   SetResDebug( .T. )
   aMisItems  := Array( 16 )
   
   DEFINE FONT oFnt NAME "Tahoma" SIZE 0, -14
   
   DEFINE WINDOW oWnd ;
      FROM 100, 100 TO 450, 650 ;//      STYLE WS_POPUP ;
      MENU BuildMenu() PIXEL NOSYSMENU
   
   //SetWindowLong( oWnd:hWnd, -16, "L" )
   ACTIVATE WINDOW oWnd 

   While oFnt:nCount > 0
      oFnt:End()
   end
   if File( "checkres.txt" )
      FErase( "checkres.txt" )
   endif
   CheckRes()   
Return nil

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

Function BuildMenu()

   local oMenu
   
   MENU oMenu FONT oFnt COLORMENU CLR_WHITE, CLR_BLUE 2013 NOBORDER
      
      MENUITEM Upper( "Primer Item" )
         MENU
            MENUITEM aMisItems[ 1 ] PROMPT Upper( "SubMenu1" )
            MENUITEM aMisItems[ 2 ] PROMPT Upper( "SubMenu2" )
            SEPARATOR
            MENUITEM aMisItems[ 3 ] PROMPT Upper( "Salir" ) ACTION oWnd:End()
         ENDMENU
      MENUITEM aMisItems[ 4 ] PROMPT Upper( "Segundo" ) ITALIC
         MENU
            MENUITEM aMisItems[ 7 ] PROMPT Upper( "SubMenu1" ) BOLD
            MENUITEM aMisItems[ 8 ] PROMPT Upper( "SubMenu2" )
            SEPARATOR
            MENUITEM aMisItems[ 9 ] PROMPT Upper( "Salir" ) ACTION oWnd:End()
         ENDMENU
      MENUITEM aMisItems[ 5 ] PROMPT Upper( "Tercero" )
         MENU
            MENUITEM aMisItems[ 10 ] PROMPT Upper( "SubMenu1" )
            MENUITEM aMisItems[ 11 ] PROMPT Upper( "SubMenu2" )
            SEPARATOR
            MENUITEM aMisItems[ 12 ] PROMPT Upper( "Salir" ) ACTION oWnd:End()
         ENDMENU
      MENUITEM aMisItems[ 6 ] PROMPT Upper( "Cuarto" )
         MENU
            MENUITEM aMisItems[ 13 ] PROMPT Upper( "SubMenu1" )
            MENUITEM aMisItems[ 14 ] PROMPT Upper( "SubMenu2" )
            SEPARATOR
            MENUITEM aMisItems[ 15 ] PROMPT Upper( "Salir" ) ACTION oWnd:End()
         ENDMENU
   ENDMENU

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
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Questions to MENU
Posted: Tue Mar 15, 2016 06:49 PM
Please, in previous sample try with this modifications

Code (fw): Select all Collapse
   MENU oMenu FONT oFnt ;
      COLORMENU CLR_WHITE, CLR_BLUE ;
      COLORSELECT CLR_RED, CLR_WHITE, CLR_BROWN ;
      2013 NOBORDER




Code (fw): Select all Collapse
   MENU oMenu FONT oFnt ;
      COLORMENU CLR_WHITE, CLR_BLUE ;
      COLORSELECT CLR_WHITE, CLR_WHITE, CLR_BROWN ;
      2013 NOBORDER


Third parameter of COLORSELECT is text of item selected

COLORSELECT CLR_RED, CLR_WHITE, CLR_BROWN ;
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
Posts: 1048
Joined: Mon Oct 24, 2005 09:54 AM
Re: Questions to MENU
Posted: Tue Mar 15, 2016 07:02 PM
With COLORMENU CLR_RED,CLR_WHITE COLORSELECT CLR_BLACK,CLR_RED,CLR_HGREEN -> WRONG -> no green text!


With COLORMENU CLR_RED,CLR_BLACK COLORSELECT CLR_BLACK,CLR_RED,CLR_HGREEN -> OK


What the first parameter from COLORSELECT?
Regards,
Günther
---------------------------------
office@byte-one.com
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Questions to MENU
Posted: Tue Mar 15, 2016 07:03 PM

You use Style 2013 ?

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
Posts: 1048
Joined: Mon Oct 24, 2005 09:54 AM
Re: Questions to MENU
Posted: Tue Mar 15, 2016 07:04 PM

I use without any style! Is this required?

Regards,
Günther
---------------------------------
office@byte-one.com
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Questions to MENU
Posted: Tue Mar 15, 2016 07:05 PM
byte-one wrote:I use without any style! Is this required?

Yes

2013 style is the only style that is fully configurable by the user
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
Posts: 1048
Joined: Mon Oct 24, 2005 09:54 AM
Re: Questions to MENU
Posted: Tue Mar 15, 2016 07:25 PM
Now is ok but the background in child-menus is gray. Can i change this?

Regards,
Günther
---------------------------------
office@byte-one.com
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Questions to MENU
Posted: Tue Mar 15, 2016 07:40 PM

Ok, I will look with detail
Regards

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
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Questions to MENU
Posted: Tue Mar 15, 2016 07:47 PM
Please, try

Code (fw): Select all Collapse
MENU oMenu FONT oFnt ;
      COLORMENU CLR_WHITE, CLR_BLUE ;
      COLORSELECT CLR_WHITE, CLR_WHITE, CLR_BROWN ;
      COLORRIGHT CLR_WHITE ;
      2013 NOBORDER
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
Posts: 1048
Joined: Mon Oct 24, 2005 09:54 AM
Re: Questions to MENU
Posted: Tue Mar 15, 2016 08:35 PM

Oh, thanks, now is ok!
For the left side i use additional COLORLEFT COL,COL

Regards,
Günther
---------------------------------
office@byte-one.com
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Questions to MENU
Posted: Tue Mar 15, 2016 08:42 PM
byte-one wrote:Oh, thanks, now is ok!
For the left side i use additional COLORLEFT COL,COL


Yes, look

[ <left: COLORBMP, COLORLEFT, LEFTCOLOR> [ <nClrToBa>, ] <nClrBkBa> ] ; // only background, not put nClrToBa
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
Posts: 1048
Joined: Mon Oct 24, 2005 09:54 AM
Re: Questions to MENU
Posted: Tue Mar 15, 2016 08:54 PM

Only background-color is not functioning!

Regards,
Günther
---------------------------------
office@byte-one.com
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Questions to MENU
Posted: Tue Mar 15, 2016 08:55 PM
Yes, bug detected

Please, change in menu.ch



        [ <oObjMenu> := ] MenuBegin( <.popup.>,, <oCtrl>, <.l2007.>, <.l2010.>,,;  //<.lUnicode.>
                         <nClrMenu>, <nClrMenutxt>, ;
                         <nClrBkBa>, <nClrToBa>, <nClrHiLi>, <nClrHiLf>, ;
                         <nClrHitx>, <nClrHiBr>, <.lMenuBar.>, <oFont>, ;
                         <.lColors.>, <.lVert.>, <.l2013.>, <.l2015.>, ;
                         [!<.lNoBorder.>], <nClrToBr> ,<nClrBkBr>, <nRightSp>,;
                         <nFactor>, <nHeight>, [!<.lInherit.>], <.lInvert.>,;
                         <nRound>, <.lUpper.> )   // lUpper is implemented in next version
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

Continue the discussion