|
To continue with this, I added the resource type 24 XML code again, but removed the style TBSTYLE_FLAT when creating the toolbars. Now the toolbars look fine, and still the dialogs have the WindowsXP style!
|
|
|
|
|
Hmmm, sorry to fill up this thread here, but removing TBSTYLE_FLAT doesn't work with the Windows classic style. A solution can be found in the threads in JM LE FOL's article on CToolbarXP.
|
|
|
|
|
Hi,
MenuXP is great, i think, congratulations! I use it in 2 applications, but now in one app some strange things happened:
I had to retrieve und change some menu strings at runtime, so i use GetMenuText(), ModifyMenu() und - for test purposes - GetMenuItemInfo() ... it works fine when i compiled WITHOUT MenuXP. With MenuXP i can't retrieve the strings from the menu bar! (GetMenuText() returns 0) But all other strings from the menu popups i can retrieve successfully. So what may be the cause for that? The menuitems in the menu bar have no resource ID, i know ... may be this is the reason? But without MenuXP it works!
Any hints??? (I am using VC6)
Thanx!
Frank
|
|
|
|
|
I would like to help you but I don't find the GetMenuText method in the MSDN documentation
Perhaps you want to say GetMenuString
Could you send me few lines of code you wrote to retrieve text?
They can help me to understand the problem.
|
|
|
|
|
Hi,
thanx for fast reply!!!
Yeah, i mean GetMenuString(), of course! I'm "a little" tired, i'm working last night until 3:00 ... uaaaa ... sorry! ..
I can reduce the problem to the following code. This works fine without MenuXP, with MenuXP GetMenuString() return 0 only for the menu bar items:
void ReplaceMenuText(CMenu *pMenu,int iLevel)
{
CString csMenutext;
if (pMenu)
{
for (unsigned int i = 0;i < pMenu->GetMenuItemCount();++i)
{
if (pMenu->GetMenuString(i,csMenutext,MF_BYPOSITION) > 0)
{
CString csNewText = .... // Some code to set new text, e.g. constant "xxx"
pMenu->ModifyMenu(i,MF_BYPOSITION,pMenu->GetMenuItemID(i),csNewText);
}
else
{
// ... here on menu separators (ok!) and menu bar items (NOT ok!)
}
ReplaceMenuText(pMenu->GetSubMenu(i),iLevel + 1); // recursion ...
}
}
}
Greetings from Germany!
Frank
|
|
|
|
|
My implementation of CMenuXP uses 2 string maps to store all item text.
I suggest you modify your code to use those string maps. Have a look to the CMenuItem constructor to understand how to use them.
Example:
CString GetMenuXPString (HMENU hMenu, UINT uItem, bool fByPosition)
{
CMenuItem item (hMenu, uItem, fByPosition);
return item.m_sCaption;
}
|
|
|
|
|
Hi, Jean-Michel,
Thanx a lot, now i can retrieve the Strings from the menu bar, too! The GetMenuXPString works only with the CMenu of the menu bar, not with the CMenu of the popups, but this does not matter, i use both methods (GetMenuString() and GetMenuXPString() depending from the menu level).
Have a nice weekend!
Frank
|
|
|
|
|
Hi, Jean-Michel,
there is another problem: I had to change the contents of the menu during runtime. I tried the method
pMenu->ModifyMenu(iNr,MF_BYPOSITION,pMenu->GetMenuItemID(iNr),csNewText);
and it works ... until today: There i insert a submenu in the submenu (two levels under the menubar). The ModifyMenu() seems to work, but later when the updating of the submenu is first made, the program crashes at this VERIFY-Line of your code:
CMenuItem::CMenuItem (HMENU hMenu, UINT uItem, bool fByPosition)
{
memset (&m_miInfo, 0, sizeof(MENUITEMINFO));
m_miInfo.cbSize = sizeof(MENUITEMINFO);
m_miInfo.fMask = MIIM_STATE|MIIM_SUBMENU|MIIM_TYPE|MIIM_DATA|MIIM_ID;
VERIFY (::GetMenuItemInfo (hMenu, uItem, fByPosition, &m_miInfo));
....
Can you give me a hint how to change correctly an specific menu entry? I think, ModifyMenu() is not a good way, hmmm?
Thanx for help!!!
Frank
|
|
|
|
|
Hello,
I want to change font of menus. Can u tell how to do this.
Thanks,
Rahul
|
|
|
|
|
Hi!
It's very nice work, but what to do if I already have some menu items with bound data? I mean that field MENUITEMINFO.dwItemData I use for my own purposes and this causes problems with using your menu.
I want this problem to be solved inside CMenuXP class not in my code
Andrew Aliphanov
|
|
|
|
|
Hi,
I have the solution for customize the CEdit and CComboBox popup menus.
And it works on Win95/Win95OSR2/Win98/Win98SE/WinNT/Win2000/WinXP/Win.Net
May altered version uses one Library from MSJ called Detours for API hooks, this is needed coz EDIT controls call TrackPopupMenu with the flag TPM_NONOTIFY, which will not notify window (param passed on TrackPopupMenu) with messages like WM_INITMENUPOPUP, etc
It includes a new class called CXPEdit that uses the macros:
ON_MENUXP_MESSAGES(), DECLARE_MENUXP(), etc
I need contact from Author to send him the code, so he can update this thread.
BR,
Hugo Caldeira
|
|
|
|
|
|
Is there any chance of getting more detail on this I am very interested...
I code in my sleep sometimes.
|
|
|
|
|
I never received any sources about this...
Is he dead ?!!!
|
|
|
|
|
I have been trying to force a redraw after making changes to gradients colour etc. At present, to see the hchanges I have to stop and restart the demo. Obviously, I'd like to be able to avoid the restart. I have tried all sorts of calls to:
CMenuXP::UpdateMenuBar()
CMenuXP::SetXPLookNFeel()
DrawMenuBar()
Invalidate()
and others, from various places within the code. I can manipulate the menu to delete entries etc, which shows that it is redrawing but I can't get the colours to redraw. I'm assuming I need to access the owner-drawn colouring routines but I have failed so far.
Can anyone suggest how this might be done?
|
|
|
|
|
OS: win98se
PL: vc++6 profissional edition
so what is the problem
i belive in KISS
KEEP IT SIMPLE STUPIT
|
|
|
|
|
Hi!
I used to disable the recent file list by OnUpdateRecentFileList() (see code below). The problem with CMenuXP is that recent file list items are diabled but not grayed or dimmed.
Any ideas?
Best regards,
Sören
BEGIN_MESSAGE_MAP(CDemoApp, CWinApp)
ON_UPDATE_COMMAND_UI(ID_FILE_MRU_FILE1, OnUpdateRecentFileList)
END_MESSAGE_MAP()
void CDemoApp::OnUpdateRecentFileList(CCmdUI* pCmdUI)
{
BOOL bBusy = FALSE;
if (m_pRecentFileList == NULL)
{
pCmdUI->Enable(FALSE);
}
else
{
m_pRecentFileList->UpdateMenu(pCmdUI);
for (int mru = 0; mru < m_pRecentFileList->GetSize(); mru++) {
if (pCmdUI->m_pMenu != NULL)
{
pCmdUI->m_pMenu->EnableMenuItem(ID_FILE_MRU_FILE1 + mru,
bBusy ?MF_BYCOMMAND|MF_GRAYED :MF_BYCOMMAND|MF_ENABLED);
}
}
}
}
|
|
|
|
|
You must associate MF_DISABLED with MF_GRAYED to really disable the items.
...
pCmdUI->m_pMenu->EnableMenuItem(..., bBusy ? MF_BYCOMMAND|MF_GRAYED|MF_DISABLED : MF_BYCOMMAND|MF_ENABLED);
...
It's valid for any items, not only for the recent file list.
|
|
|
|
|
I ran into the same problem trying to enable/disable a menu with submenus depending on the state of the submenus.
MSDN says about the nEnable flag bits of EnableMenuItem:
MF_DISABLED - Disables the menu item so that it cannot be selected but does not dim it.
MF_GRAYED - Disables the menu item so that it cannot be selected and dims it.
So MF_GRAYED alone should do the job - and does it when I set
SetXPLookNFeel (this,false);
|
|
|
|
|
explain why when i write more than 4 letters it shrink the caption to 4 letters
i belive in KISS
KEEP IT SIMPLE STUPIT
|
|
|
|
|
You need to give some more information such as system settings, OS display settings, etc.
Captions look fine here.
|
|
|
|
|
I encountered a problem when implementing MenuXP in my MDI application by following the MDI sample app.
The application I made may not open any child windows on startup. This causes undesired behavior.
The menu dropdowns have the flat look, but the menu bar itself does not until you create a new child window.
The workaround is to simply place this call somewhere in the creation of the parent frame, such as CMainFrame::OnCreate()
CMenuXP::UpdateMenuBar (this);
You also want to keep the UpdateMenuBar() call in each of your child frames.
I would like to end by saying this code rocks! Nice job!
|
|
|
|
|
That didn't work for me if I don't keep
<br />
CMenuXP::UpdateMenuBar (GetMDIFrame());<br />
on child frames.
Jaime
|
|
|
|
|
Correct. Re-read my post above. You must keep that call in your child frames.
|
|
|
|
|
I have a RichEdit control on my dialog and i was wondering how i could make it have the nice styles...
I have a dialog box which has already been customized to have the OfficeXP styles (the menus and everything...) on the dialog, I have a RichEdit control, to which I attached a popup menu... Should the popup menu have the styles by default, given the above conditions?
Thanks,
Alex.
|
|
|
|