|
|
I do know. Mr. Stupid had been there and placed code to catch the message inside the inherited toolbar. Grrr !
|
|
|
|
|
Hello,
I have a menu with a submenu. On Highlighting main menu......when sub menu is appearing little triangle on right side of main menu is disappearing. Please tell how to solve this.
Thanks,
Rahul.
|
|
|
|
|
See 'Blue box highlight' thread. I believe this will fix your issue as well.
|
|
|
|
|
Everything worked perfect.... until I tried to set up menus to behave when the user clicked. I mean, the presentation and so on works perfect, but the trouble that I have is that I can't or I don't know where I may introduce the ON_COMMAND(...........), it doesn't work, it seems like nothing is returned, it works the same as if I wouldn't change anything.
I need help, please.
Thank you, Rafael from spain.
MaestroProgramador.Com
Where every source code is loved like a girl.
|
|
|
|
|
Hi,
I have the following strange effect, which is that my main menu captions are overwritten by the captions of submenu. The situation is that I have the same command in both the main menu and some popup-menu's, but that their caption is different.
To illustrate this, in the main menu I have a "Setup" main-item with in this "Setup" menu the items "Setup Size...", "Setup Color..." and "Setup Font...". But the user can also rightclick on an object in my document, and then a submenu appears with Item "Size >" and subitems "10 mm", "20 mm", "30 mm" and "Dialog...".
Now, the mainmenu item "Setup Color..." and the submenu item "Dialog..." both have the same command ID. After retrieving the pop-up menu, the main menu item "Setup Color..." becomes "Dialog..."
A work-around would be to assign a different command ID to the item in the main menu and the submenu and map both command to the same function, but this behaviour is different from the MFC standard menus, so then it would at least be something to mentions in the description of CMenuXP.
|
|
|
|
|
I agree
This is a major limitation of my class.
And the article should be more explicit about that.
|
|
|
|
|
Okay, would this mean I'd try the workaround by specifying different command ID's then trying to/waiting for the CMenuXP to be fixed/enhanced for this?
|
|
|
|
|
I converted my application to this menu style and now my application is not Windows 95 compatible.
These errors are displayed:
"... exe file is linked to missing export USER32.DLL: Track Mouse event" and "Unable to execute file ... .exe. Create process failed: Code 31."
If I exclude calls to CMenuXP functions in the code using GetVersionEx for Windows 95 users, can this problem be overcome or am I stuck with a Windows 95 incompability if I use this menu style which I very much like?
|
|
|
|
|
I remembered that I used TrackMouseEvent is some button code which did not cause problems so I adopted these changes:
commented out this line in tools.cpp
//extern "C" WINUSERAPI BOOL WINAPI TrackMouseEvent (LPTRACKMOUSEEVENT lpEventTrack);
and changed all occurrences of ::TrackMouseEvent (&tme);
to ::_TrackMouseEvent (&tme);
I don't know whether the last change is significant but the result of these changes is no more runtime errors and the menu system seems to work OK for Windows 95.
|
|
|
|
|
Hi,
I'm trying to use the CMenuXP Style, but i have troubles with the toolbars. The area outside the clipbox (e.g. the area set bij SetBorders(), where the gripper is drawn) is not erased. Thus the border for the CToolBarXP's looks weird!
I've tried to make a clean project with the CMenuXP style, and for that clean project, the toolbars are ok. Now it looks to me that I am missing something? The OnNcPaint() function is never overriden. I carefully checked every declaration and macro, but everything looks fine in the original project, still the Toolbars those weird borders.
I uploaded a picture to www.vdkolk.nl/~marco/ncerr.png so that you can see what I mean. I could also give some code snippets if you like.
Regards,
Marco.
|
|
|
|
|
I have not enough element to solve your problem.
Some directions:
In my project, I completly remove 3d borders (see the afxData2 object in CToolBarXP.cpp). In your screenshot borders seem to be present)
Are you sure the not painted area is from toolbar ? (perhaps it's the parent toolbar area)
Try to handle WM_NCPAINT to paint yourself this area. You also must paint the gripper.
Remove each method of my class to understand where the problem come from.
If you can send me a compilable project that have the problem, I can debug it and try to find a solution.
Regards
Jean-Michel
|
|
|
|
|
After one full day of disabling pieces of code, I found the problem. The origin of this problem was a special resource I added in order to have Windows XP styles (resource type 24, id 1, with some special XML code containing a manifest), actually also some article here on CodeProject. This resource was already added for quite a long time to my project, but I used some other flat toolbar control, that drew it own grippers.
Actually when I complete removed the CMenuXP code and the other flat toolbar control, the grippers where still transparent, but here I was using the standard MFC CToolBars! So nothing wrong with CMenuXP. Cool code, and now just re-enabled it my project, after removing the resource! Also thanks for your quick answer. Your remark "Remove each method of my class to understand where the problem come from", actually was the clue to finding it!
Thanks!
|
|
|
|
|
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
|
|
|
|
|
|