![]() |
Menus with big icons |
Post Reply ![]() |
Author | |
Denbuerg ![]() Newbie ![]() Joined: 14 March 2006 Location: Germany Status: Offline Points: 12 |
![]() ![]() ![]() ![]() ![]() Posted: 23 March 2006 at 7:15am |
Hi,
what do I have to do, to create menus with big icons? Just like the Windows Start menu. |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hello,
try pCommandBars->GetCommandBarsOptions()->szPopupIcons = CSize(24, 24); |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
Denbuerg ![]() Newbie ![]() Joined: 14 March 2006 Location: Germany Status: Offline Points: 12 |
![]() ![]() ![]() ![]() ![]() |
This doesn't work.
I have a dialog similiar to the sample DialogSample. Except I load 32x32 icons. pCommandBars was NULL when I tried: CXTPCommandBars* pCommands = m_wndMenuBar.GetCommandBars(); |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hi, You can create some commandbars object and attach to menu bar... (SetCommandBars) I recommend you update your version. In 9.81 there is ability to use customization/reposition toolbars.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
davidsimmonds ![]() Newbie ![]() Joined: 16 December 2005 Status: Offline Points: 17 |
![]() ![]() ![]() ![]() ![]() |
I have bitmaps that are 28x16. I attach them to the menu system like this for certain on-demand items; that is, I don't have a toolbar to match the items. The problem is that the system stretches the menu bitmap to 28x28. Other menu systems don't do this. It just puts up the bitmap in the size that I want. Here is the code that I use. void CMainFrame::InsertMenuItem(CXTPControls* pCommandList, int nPosition, int nID, LPCTSTR pszText, int nBitmapID/*=0*/){ CString str = pszText; CString strHotKey = GetAccelName(nID); if (!strHotKey.IsEmpty())str += _T( "\t")+strHotKey;CXTPControl* pControl = pCommandList->Add(xtpControlButton, nID, str, -1, TRUE); if (nPosition != -1)pCommandList->MoveBefore(pControl, nPosition+1); if (nBitmapID != 0 && !theApp.m_b508UI){ CBitmap bmp; BITMAP bm; bmp.LoadBitmap(nBitmapID); bmp.GetBitmap(&bm); CImageList iml; iml.Create(bm.bmHeight, bm.bmHeight, ILC_MASK, 0, 0); iml.Add(&bmp, RGB(255,128,0)); pControl->SetCustomIc on(iml.ExtractIcon(0)); } } } |
|
![]() |
|
davidsimmonds ![]() Newbie ![]() Joined: 16 December 2005 Status: Offline Points: 17 |
![]() ![]() ![]() ![]() ![]() |
Without the following statement, the bitmaps are clipped at 16x16. pCommandBars->GetCommandBarsOptions()->szPopupIcons = CSize(28, 16); With that line in place, the bitmap are stretched, but are still clipped. |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Just tried and don't see any problems... Try to create new application with wizard and reproduce it with it. Do you have 9.80/9.81? As I remember it was some changes in this field. |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
davidsimmonds ![]() Newbie ![]() Joined: 16 December 2005 Status: Offline Points: 17 |
![]() ![]() ![]() ![]() ![]() |
9.81.
|
|
![]() |
|
davidsimmonds ![]() Newbie ![]() Joined: 16 December 2005 Status: Offline Points: 17 |
![]() ![]() ![]() ![]() ![]() |
You have a 28x16 bitmap and it looks fine?
|
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Steps: Open PrintPreview sample Open main Toolbar and change icons size to 28*16 add pCommandBars->GetCommandBarsOptions()->szPopupIcons = CSize(28, 16);
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
davidsimmonds ![]() Newbie ![]() Joined: 16 December 2005 Status: Offline Points: 17 |
![]() ![]() ![]() ![]() ![]() |
Leave the icons in the toolbar as they were (16x16 I think). Then create a bitmap that is 28x16. Create a new menu item somewhere that does not have a toolbar item. Assign the 28x16 bitmap to that new menu item. What do you see? Is the icon properly sized or is it clipped or sized very small?
|
|
![]() |
|
davidsimmonds ![]() Newbie ![]() Joined: 16 December 2005 Status: Offline Points: 17 |
![]() ![]() ![]() ![]() ![]() |
No answer to the question?
|
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hello, just tried code you attached and see problem. Steps to fix: add pCommandBars->GetCommandBarsOptions()->szPopupIcons = CSize(28, 16); replace in your code iml.Create(bm.bmHeight, bm.bmHeight, ILC_MASK, 0, 0); to iml.Create(bm.bmWidth, bm.bmHeight, ILC_MASK, 0, 0);
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
davidsimmonds ![]() Newbie ![]() Joined: 16 December 2005 Status: Offline Points: 17 |
![]() ![]() ![]() ![]() ![]() |
Yes, I found that bug also, but it does not fix the problem. I want to have the toolbar left at 16x16. I have some custom bitmaps that are 28x16. I want the bitmaps that come from the toolbar and placed automatically by the Xtreme Toolkit framework to look correct AND I want my 28x16 bitmaps to look correct. Right now, the 28x16 look correct, but the 16x16 bitmaps are stretched. Other menu frameworks allow this to work. The Xtreme toolkit must be able to do it as well.
|
|
![]() |
|
davidsimmonds ![]() Newbie ![]() Joined: 16 December 2005 Status: Offline Points: 17 |
![]() ![]() ![]() ![]() ![]() |
Also, I have this in my OnCreate method: // Initialize the command bars if (!InitCommandBars()) return -1; // Get a pointer to the command bars object.CXTPCommandBars* pCommandBars = GetCommandBars(); if (pCommandBars == NULL){ TRACE0( "Failed to create command bars object.\n"); return -1; // fail to create} pCommandBars->GetCommandBarsOptions()->szPopupIcons = CSize(28, 16); // Add the menu barCXTPCommandBar* pMenuBar = pCommandBars->SetMenu( _T( "Menu Bar"), IDR_MAINFRAME); if (pMenuBar == NULL){ TRACE0( "Failed to create menu bar.\n"); return -1; // fail to create} |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
It is designed behaviour. You must create 28*16 image for each icon you plan to use in Popup.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
davidsimmonds ![]() Newbie ![]() Joined: 16 December 2005 Status: Offline Points: 17 |
![]() ![]() ![]() ![]() ![]() |
It is bad design then. If you make a toolbar 28x16, it will look wierd. Like I said, other menu systems allow for this. Can the Xtreme Toolkit not be modified to do so as well?
|
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
You don't need to make toolbar 28*16, you need to create another icon set for 28*16 icons. create some bitmap for icons and call pImageManager->SetIcons(IDR_TOOLABAR, IDR_BITMAP); |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
davidsimmonds ![]() Newbie ![]() Joined: 16 December 2005 Status: Offline Points: 17 |
![]() ![]() ![]() ![]() ![]() |
So if I have a toolbar that is 16x16 already that the framework is using, I can simply use another bitmap that is 28x16 and make the call like you suggest above and the menus will take the icons from there and not from the toolbar and the toolbar will still look as it should?
|
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Yes. menus first tring to find best bitmap in ImageManager if not found when it will resize exists. |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |