Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Forums:

Is there a way, and if so what is the best way, to calculate the
minimum required size of a menu? Say, I want a menu with three
items in it and only want to set the menu rect to the minimum required
height for the menu. How do I calculate this? I know it is dependent
on the font size, title font size, and icon height, but there also seems
to be some line spacing that varies depending on the phone.

I be able to calculate this for any phone my app runs on.

Thanks for any help you can provide.

Tom

i just encountered the same problem.
I know the old post was a long time ago, but maybe in the last 3 years someone had found a way???

i just encountered the same problem.
I know the old post was a long time ago, but maybe in the last 3 years someone had found a way???

In the 3.x SDK there is an API - IMENUCTL_GetItemRect which gets teh individual rectangle of an item.
/*
* pMenu is the Menu Control
*/
AEERect rcItem; /* Menu Item Rectangle */
int32 nItemHgt = 0; /* Menu Item Height */
int32 cItems = 0; /* Number of Menu Items */
int32 nMenuHgt = 0; /* Total Menu Height */
IMENUCTL_GetItemRect ( pMenu, 0, &rcItem );
nItemHgt = rcItem.dy;
cItems = IMENUCTL_GetItemCount ( pMenu );
nMenuHgt = cItems * nItemHgt;
But of 2.x please refer http://brewforums.qualcomm.com/showthread.php?t=2029&highlight=textctl+h...
Usually the Menu Item Height is "FontHeight + 10". (Please correct me if I am wrong)

In the 3.x SDK there is an API - IMENUCTL_GetItemRect which gets teh individual rectangle of an item.
/*
* pMenu is the Menu Control
*/
AEERect rcItem; /* Menu Item Rectangle */
int32 nItemHgt = 0; /* Menu Item Height */
int32 cItems = 0; /* Number of Menu Items */
int32 nMenuHgt = 0; /* Total Menu Height */
IMENUCTL_GetItemRect ( pMenu, 0, &rcItem );
nItemHgt = rcItem.dy;
cItems = IMENUCTL_GetItemCount ( pMenu );
nMenuHgt = cItems * nItemHgt;
But of 2.x please refer http://brewforums.qualcomm.com/showthread.php?t=2029&highlight=textctl+h...
Usually the Menu Item Height is "FontHeight + 10". (Please correct me if I am wrong)