Originally posted by: Priyanka
Hi,
I need the method to create menus dynamically.
thankyou,
bye
priyanka
Originally posted by: Mike Philips
Here's a link to a smart menu control:
http://www.exontrol.com/sg.jsp?content=products/exmenu
Regards,
Grest work.
Mike
Originally posted by: MAV
How to use this class for displaying 32x32 icons ?
Thanks
Originally posted by: Jase Jennings
Under XP, separators are drawn in a gray text, although the background for the menu is white - so this menu looks plain old ugly on XP. If i find the solution, i'll post it here. In the meantime, i could use a little help :)
ReplyOriginally posted by: Mahesh
when i tried using the pop up menu,the menu items are not displaying properly. I created a menu in the resouce editor and used the LoadMenu method..
so can anyone help me to solve the problem.
Thanks & Regards
Mahesh
Originally posted by: xiaolei zhuansun
I popup a menu with 30 items(or 40, 50, any number that the height of the menu > deskRect/2), then I click on the middle of the screen, I found that the menu can't popup.
here is my solution:
I found a new bug while I use the cool control:
1) insert new function:
BOOL CXXXMenu::PositionSubMenu(CPoint pt, CRect menuRect, BOOL bRight)
{
CRect deskRect;
GetDesktopWindow()->GetWindowRect(&deskRect);
int nLeft = bRight ? pt.x : pt.x - menuRect.Width();
if(deskRect.Height() < menuRect.Height())
{
MoveWindow(nLeft, 0, menuRect.Width(), deskRect.Height());
return TRUE;
}
if(deskRect.Height()/2 < pt.y)
MoveWindow(nLeft, 0, menuRect.Width(), menuRect.Height());
else
MoveWindow(nLeft, deskRect.bottom - menuRect.Height(), menuRect.Width(), menuRect.Height());
return TRUE;
}
2) chage the function "PositionMenuWindow(...)", to
void CXXXMenu::PositionMenuWindow(CPoint pt, CRect* pItemRect, CRect menuRect)
{
CRect deskRect;
.
.
.
if(pItemRect)
{
if(PositionSubMenu(...) == FALSE)
{
if(PositionSubMenu(...) == FALSE)
{
if(PositionSubMenu(...) == FALSE)
{
if(PositionSubMenu(CPoint(pItemRect->left, pItemRect->bottom), menuRect, FALSE, FALSE) == FALSE)
{
BOOL bRight = (pItemRect->right + menuRect.Width() > deskRect.right) ? FALSE : TRUE;
int nLeft = bRight ? pItemRect->right : pItemRect->left;
PositionSubMenu(CPoint(nLeft, pItemRect->bottom), menuRect, bRight);
}
.
.
.
}
But unfortunately, this is only partial solution, if the menu have so many items, the height of menu will larger then the deskRect.Height(). with this solution, it can only display part of the memu item.
Is there any easy way to implement the feature like CMenu---there are two spin on the top and bottom of the menu window?
Originally posted by: Stephan Schumann
Because of the multiple inheritance there are to defined new operators (Both in CObject) is there a solution for this problem
ReplyOriginally posted by: Cho, SungHee
I faced two major bugs using CBMPMenu.
One was a bug in case of clicking seperator,
Other was a bug in case of clicking the area of outside.
I want to help men undergo bug2 with my poor codes.
At First, Declare a boolean variable in CBMPMenu.h
Add "bool m_bEndModalLoop;" in Class CBMPMenu.
and then,
Add 2 member functions in CBMPMenu.h & CBMPMenu.cpp
Add "int RunModalLoop(DWORD dwFlags=0);" in Class CBMPMenu
and add "void EndModalLoop(int);" in Class CBMPMenu
Real source code follows as below.
int CGradientMenu::RunModalLoop(DWORD dwFlags) {
MSG msg;
m_bEndModalLoop = false;
while (m_bEndModalLoop==false) {
while ( PeekMessage (&msg, 0, 0, 0, PM_REMOVE) ) {
TranslateMessage (&msg) ;
DispatchMessage (&msg) ;
}
}
return 0;
}
void CGradientMenu::EndModalLoop(int nResult) {
m_bEndModalLoop = true;
::ShowWindow(m_hWnd, SW_HIDE);
}
That's all. be helpful to others.
and Thanks to Coral.
Originally posted by: Lior
add after comment line "draw text" the following:
//draw the text
//changes
if (menuInfo.fState & MFS_DEFAULT ) {
LOGFONT logfont;
CFont font;
this->m_oMenuFont.GetLogFont(&logfont);
logfont.lfWeight = FW_BOLD;
font.CreateFontIndirect(&logfont);
dc.SelectObject(&font);
} // end changes
dc.DrawText(menuInfo.dwTypeData, rcItem, DT_LEFT|DT_VCENTER);
dc.SelectObject(pOldFont);
Originally posted by: SeungKoo
After menu is shown, I clicked the area not in dialgo box.
But the menu was not destroyed and debug error dialog appeared.
How can I fix this problem?
Reply