Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - truncated description in menu popup / suggestion
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

truncated description in menu popup / suggestion

 Post Reply Post Reply
Author
Message
Michl View Drop Down
Senior Member
Senior Member


Joined: 14 September 2007
Status: Offline
Points: 138
Post Options Post Options   Thanks (0) Thanks(0)   Quote Michl Quote  Post ReplyReply Direct Link To This Post Topic: truncated description in menu popup / suggestion
    Posted: 25 October 2010 at 5:54am
hello,

add long descriptions to buttons and use these buttons for popup menus.
The popup menu supports only 2 lines of description.


CSize szDescription = pDC->GetTextExtent(pButton->GetDescription());
CRect rcDescription(0, 0, (szDescription.cx + 20) / 2, 0);
pDC->DrawText(_T("1\n2"), rcDescription, DT_CALCRECT | DT_WORDBREAK);

int nWidth = nGripperWidth + m_nPopupBarTextPadding + rcText.Width() +  rcShortcut.Width() + 32;

return GetControlSize(pButton, CSize(max(nWidth, nGripperWidth + m_nPopupBarTextPadding + szDescription.cx / 2 + 32),
        max(szImage.cy, rcDescription.Height() + rcText.Height() + 19)), FALSE);


This code is okay, but if following condition is true then the width of popup menu is decreased.

if (!GetParent()->IsResizable() && CXTPPopupBar::m_dMaxWidthDivisor > 0 && szControl.cx > (CXTPPopupBar::m_dMaxWidthDivisor * rcWork.right))
    szControl.cx = int(CXTPPopupBar::m_dMaxWidthDivisor * rcWork.right);


If you have a screen resolution lower than 1/3 of popup menu width (e.g. some screens or virtual boxes), so the description is breaking into 3 lines or more. But only 2 lines are still displaying.

A "workaround" is to set dMaxWidthDivisor to 1.0 to avoid resizing. But it would be more nice, if the popup menu can dynamically grow his height.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.137 seconds.