- Code: Select all Expand view
- oMenu:aMenuItems[x]:setprompt("???")
oMenu:aMenuItems[x]:setprompt("???")
MENUITEM { "Prompt", "Array", "Definition" } ACTION MsgInfo( "Fichero de Zonas" )
MENUITEM { || "CodeBlock Definition" }
MENUITEM "Change Prompt SubMenu-2 ( Item 7 ) - Array" ;
ACTION ( oMnu:aMenuItems[ 2 ]:bAction:aMenuItems[ 7 ]:SetChangePrompt( {"Lunes", "Martes", "Miercoles", "Jueves" } ) )
SEPARATOR
MENUITEM "Change Prompt SubMenu-2 ( Item 8 ) - CodeBlock" ;
ACTION ( oMnu:aMenuItems[ 2 ]:bAction:aMenuItems[ 8 ]:SetChangePrompt( { || "Codeblock assigned" } ) )
MENUITEM "Restore Prompt Menu" ACTION oMnu:aMenuItems[ 2 ]:RestorePrompt()
SEPARATOR
cnavarro wrote:Richard, I have not forgotten
oMenu1:aMenuItems[2]:SetChangePrompt ( "Newname" )
#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
//----------------------------------------------------------------------------//
@ C_RANDV,C_RANDH+(C_STEPH_MID) ADD BUTTON oBtVer1 PROMPT "Wettbewerb" MENU oMenu1 GROUP oGrp POPUP C_TBUTTFORM_MID BITMAP "ver_1" MESSAGE "Ergebnis(se) in Wettbewerb übertragen" TOOLTIP {"Ergebnis(se) in Wettbewerb übertragen",TX_TOOLTIP_M}
You say, that in a popup menu all items new created every call!?
#include "FiveWin.ch"
static oWnd, oMenu, lVar := .F.
//----------------------------------------------------------------------------//
function Main()
local oBtn
DEFINE WINDOW oWnd ;
FROM 1, 1 TO 20, 65 ;
TITLE "FiveWin - Testing Popup Menus"
SET MESSAGE OF oWnd TO "Press Mouse Left Button to activate the Popup"
ACTIVATE WINDOW oWnd ;
ON RIGHT CLICK ShowPopUp( nRow, nCol )
return nil
//----------------------------------------------------------------------------//
function BuildPopup()
MENU oMenu POPUP // Creating a POPUP
MENUITEM "Open"
MENU
MENUITEM "Change" MESSAGE "New whatever..." ACTION BuildPopup()
SEPARATOR
MENUITEM "Get" ;
MESSAGE "Get whatever..." ;
ACTION cGetFile( "Clipper DataBase (*.dbf) | *.dbf |" + ;
"Paradox DataBase (*.db) | *.db",;
"Please Select" )
ENDMENU
MENUITEM "Close"
MENU
MENUITEM "New..."
SEPARATOR
MENUITEM "Old..."
ENDMENU
MENUITEM "Select" MESSAGE "Select whatever..."
MENUITEM "All" ACTION MsgInfo( "Todo" ) MESSAGE "Everything"
SEPARATOR
MENUITEM "More..." ACTION MsgInfo( "More" ) ;
MESSAGE "This is just an example"
ENDMENU
return oMenu
//----------------------------------------------------------------------------//
function ShowPopup( nRow, nCol )
BuildPopup()
if !lVar
lVar := !lVar
else
oMenu:aMenuItems[ 2 ]:SetChangePrompt( "Prompt more long 1234567890" )
endif
ACTIVATE POPUP oMenu WINDOW oWnd AT nRow, nCol
return nil
//----------------------------------------------------------------------------//
James Bott wrote:Günther,
Maybe as a workaround you could make the one of the original menu items longer by adding trailing spaces. Make it long enough to handle the replacement menu item.
Just a thought.
James
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot], Silvio.Falconi and 46 guests