Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Changing Pad/Bar Prompt at run-time
Message
From
30/07/2004 08:08:30
 
 
To
30/07/2004 06:16:47
Emanuele Bonin
EB Soluzioni Informatiche
Tezze S/B, Italy
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00928219
Message ID:
00929529
Views:
21
Hi Emanuele

>Re-Hi Herman! 8)
>
>Sorry if i'm appearing annoying

It's OK, glad if I can help :-)


>but i want show to you the Candidate-Release code that i
write and seems to found to change all caption in a menu al all submenus. I used the methods modify menu instead on setmenuiteminfo ... because this last one seems don't work with popup.
>

It should work actually because SetMenuItemInfo is an extended version of ModifyMenu. but since VFP submenus is already OWNER-DRAW this is a bit difficult to make some changes. To be honest the last time I tried only to get the submenu item. Seems a bit confusing to change it


>The Last My question regard the fact that this code work only for enabled caption do you know why ?
>
>Do you know say me if the only way is ungrayed it modify it and regrayed it ?
>
>Thanx in Advance for all your support to my hill-mind 8)
>
>void LoopMenu(HMENU hMenu)
>{
>
> MENUITEMINFO MII;
> int x, iCount;
> char itemText[80];
> char Stringa[200];
> HMENU hSubMenu;
>
> iCount = GetMenuItemCount( hMenu );
> for (x=0; x < iCount; x++)
> {
> GetMenuString(hMenu, x, itemText, 80, MF_BYPOSITION);
> sprintf( itemText, "Menu #&%d", x );
> hSubMenu = GetSubMenu(hMenu, x);
> ModifyMenu(hMenu, x, MF_BYPOSITION + MF_STRING, 0, itemText);
> if(hSubMenu != NULL) LoopMenu(hSubMenu);
> }
>}
>
>void EntryPoint(hWnd)
>{
> LoopMenu(GetMenu(hWnd));
> DrawMenuBar((HWND) parm->p[0].val.ev_long);
>}

Try to enable the menu, refresh, set the item, then re-disabled. Here is an example but it seems only works only if the submenu has been opened at least one time. Maybe you should try to subclass then watch (WM_MEASUREITEM) when the first time the submenu display
iSubCount = GetMenuItemCount( hSubMenu );
for (i=0; i < iSubCount; i++)
{
	MII.fMask = MIIM_DATA | MIIM_STATE | MIIM_STRING;
	GetMenuItemInfo( hSubMenu, i, TRUE, &MII );
	sprintf( itemText, "SubMenu #&%d", i );

	if (MII.fState & MF_GRAYED)
	{
		EnableMenuItem( hSubMenu, i, MF_BYPOSITION | MF_ENABLED );
		DrawMenuBar( hWnd);
	}
	ModifyMenu( hSubMenu, i, MF_BYPOSITION | MF_STRING, 0,  itemText );

	if (MII.fState & MF_GRAYED)
	{
		EnableMenuItem( hSubMenu, i, MF_BYPOSITION | MF_GRAYED );
		DrawMenuBar( hWnd );
	}
}
Oh, by the way _Screen.HWND doesn't have a menu. The VFP system main menu is in _VFP.HWND
Herman
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform