Günther
When an item is painted, it is not possible to modify its dimensions ( for now ).
Please try this sample with this instructions:
Execute sample and
1.- Do not click on the main menu (neither the first item nor the second item)
2.- Click the "Change Prompt" button
3.- Click on the second item in the main menu and see the change in the prompt
4.- Now, click on the item ("Exit"), and click on the second option "Change Prompt SubMenu-1 to Array"
5.- Click on the first item in the main menu and see the change in the last item
6.- Click on the "Exit" item and select the first option: you will see that the second prompt has changed but not its dimensions even though the Drawmenubar statement is executed.
All right
Now restart the program
1.- Click on the menu and see all the submenus
Repeat the process from the point 2.- above
I have been investigating this problem for a while, but there is no function to refresh the menu. There is no information in the windows documentation about it.
But I'm still with it
This problem only occur with menu bar, not with popupmenu ( These menus are created and destroyed every time )
Regards
- Code: Select all Expand view
#include "Fivewin.ch"
//----------------------------------------------------------------------------//
//
// Test change prompt menuitem
//
//----------------------------------------------------------------------------//
Static oWnd
Static oFont
Static nHFont
Static cFont
Static lVar := .F.
Function Main()
local oF1
local oBtn
cFont := "Verdana"
nHFont := 14
DEFINE FONT oFont NAME cFont SIZE 0, -nHFont
DEFINE WINDOW oWnd ;
TITLE " Test Menu change and Evaluate Prompts " + " - Ver.: " + FWVERSION + if( IsExe64(), ;
" ( 64", " ( 32" ) + " bits ) - " + FWString( "User" ) + ;
": " + WNetGetUser() + " - " + hb_Compiler() ;
MENU MenuSal() ;
COLOR CLR_WHITE, METRO_STEEL
@ 400, 300 BUTTON oBtn PROMPT "Change" PIXEL SIZE 100, 60 ;
ACTION ( lVar := !lVar, oWnd:oMenu:aMenuItems[ 2 ]:bAction:aMenuItems[ 3 ]:SetChangePrompt( "Prompt more long 1234567890" ) )
@ 400, 500 BUTTON oBtn PROMPT "Restore" PIXEL SIZE 100, 60 ;
ACTION oWnd:oMenu:aMenuItems[ 2 ]:bAction:aMenuItems[ 3 ]:RestorePrompt()
ACTIVATE WINDOW oWnd MAXIMIZED
RELEASE FONT oFont
Return nil
//----------------------------------------------------------------------------//
Function MenuSal()
local oMnu
local oMnu1
local oldMnu
MENU oMnu NOBORDER OF oWnd 2013 //FONT oFont
MENUITEM "Datos"
MENU
MENUITEM "Test old SetPrompt" ;
ACTION ( oMnu:aMenuItems[ 2 ]:bAction:aMenuItems[ 3 ]:SetPrompt( "PPPPPPPPPPPPPPPPPPPP" ) )
SEPARATOR
MENUITEM { "Prompt", "Array", "Definition" } ACTION MsgInfo( "Fichero de Zonas" )
MENUITEM { || "CodeBlock Definition" }
MENUITEM "Tools"
MENU oMnu1
MENUITEM "Copia de Seguridad"
MENUITEM "Herramientas"
SEPARATOR
MENUITEM "Otros"
ENDMENU
ENDMENU
MENUITEM "Otros Items"
MENU
MENUITEM { || If( lVar, "TRUE", "FALSE" ) }
SEPARATOR
MENUITEM "Item_7" ACTION MsgInfo( "Item_7" )
ENDMENU
MENUITEM "Exit"
MENU
MENUITEM "Change Prompt Menu Bar" ACTION ( oMnu:aMenuItems[ 2 ]:SetChangePrompt( "Prompt Changed" ), DrawMenuBar( oWnd:hWnd ) )
SEPARATOR
MENUITEM "Change Prompt SubMenu-1 to Array" ;
ACTION ( oMnu:aMenuItems[ 1 ]:bAction:aMenuItems[ 5 ]:SetChangePrompt( { "A", "B", "C", 4, "5" } ) )
SEPARATOR
MENUITEM "Exit Test" ACTION oWnd:End()
ENDMENU
ENDMENU
Return oMnu
//----------------------------------------------------------------------------//