Print Page | Close Window

truncated description in menu popup / suggestion

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=17481
Printed Date: 27 September 2024 at 10:47am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: truncated description in menu popup / suggestion
Posted By: Michl
Subject: truncated description in menu popup / suggestion
Date 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.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net