Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Widgets - General questions or Mixed problems » Images in menus causing enormous padding
Images in menus causing enormous padding [message #14639] Wed, 05 March 2008 16:29 Go to next message
mordrek is currently offline  mordrek
Messages: 3
Registered: March 2008
Junior Member

Hi.
I'm doing a menu-manager that creates menus from loaded XML files and all is fine and dandy except for when adding image to the menu after loading it from file:

bar.Add(title,THISBACK1(MyCallback,name)).Image(image);


The image appears in the menu alright, but even though the menu image itself becomes very small (fitting for a menu item), the space around it is as big as the original image when it comes to height.
It looks like this (@ is the image):

---+----------------+
|  |Menu item 1     |
+--+----------------+
|  |                |
|  |                |
| @|Menu item 2     | 
|  |                |
|  |                |
+--+----------------+


Anyone know how this can happen or how to solve it?


Re: Images in menus causing enormous padding [message #14640 is a reply to message #14639] Wed, 05 March 2008 17:26 Go to previous messageGo to next message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
Smile Nevermind

[Updated on: Wed, 05 March 2008 18:12]

Report message to a moderator

Re: Images in menus causing enormous padding [message #14641 is a reply to message #14639] Wed, 05 March 2008 17:39 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Thanks, a bug. Fix:

CtrlLib/MenuItem.cpp 302
Size MenuItem::GetMinSize() const
{
	Size sz1 = GetTextSize(text, font);
	Size sz2(0, 0);
	if(accel) {
		sz2 = GetTextSize(GetKeyDesc(accel), font);
		sz2.cx += 12;
	}
	Size lsz = min(maxiconsize, licon.GetSize());
	Size rsz = ricon.GetSize();
	return AddFrameSize(Size(max(lsz.cx, leftgap) + sz1.cx + max(sz2.cx, (rsz.cx ? 16 : 0))
	                         + max(rsz.cx, 16) + textgap + 10,
	                         max(max(lsz.cy, rsz.cy) + 4, sz1.cy + 6)));
}


Note: U++ reduces the size of icons, it is intentional. You can adjust the minimal size using MenuBar::MaxIconSize. Using "INT_MAX" here is OK too Smile

Mirek
Re: Images in menus causing enormous padding [message #14643 is a reply to message #14641] Wed, 05 March 2008 18:50 Go to previous message
mordrek is currently offline  mordrek
Messages: 3
Registered: March 2008
Junior Member

Fantastic! Now all I need is some free time to continue Smile
Previous Topic: Show a specific child ctrl from child ctrl stack
Next Topic: Can't set value in switch with EnableValue
Goto Forum:
  


Current Time: Sat Apr 27 15:24:16 CEST 2024

Total time taken to generate the page: 0.06812 seconds