Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Menus with big icons
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Menus with big icons

 Post Reply Post Reply
Author
Message
Denbuerg View Drop Down
Newbie
Newbie


Joined: 14 March 2006
Location: Germany
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote Denbuerg Quote  Post ReplyReply Direct Link To This Post Topic: Menus with big icons
    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.
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 23 March 2006 at 8:23am

Hello,

 

try

pCommandBars->GetCommandBarsOptions()->szPopupIcons = CSize(24, 24);

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Denbuerg View Drop Down
Newbie
Newbie


Joined: 14 March 2006
Location: Germany
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote Denbuerg Quote  Post ReplyReply Direct Link To This Post Posted: 23 March 2006 at 8:55am
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();
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 23 March 2006 at 12:22pm

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
Back to Top
davidsimmonds View Drop Down
Newbie
Newbie


Joined: 16 December 2005
Status: Offline
Points: 17
Post Options Post Options   Thanks (0) Thanks(0)   Quote davidsimmonds Quote  Post ReplyReply Direct Link To This Post Posted: 24 March 2006 at 5:16pm

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));

    }

  }

}

Back to Top
davidsimmonds View Drop Down
Newbie
Newbie


Joined: 16 December 2005
Status: Offline
Points: 17
Post Options Post Options   Thanks (0) Thanks(0)   Quote davidsimmonds Quote  Post ReplyReply Direct Link To This Post Posted: 24 March 2006 at 5:19pm

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.

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 24 March 2006 at 9:22pm

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
Back to Top
davidsimmonds View Drop Down
Newbie
Newbie


Joined: 16 December 2005
Status: Offline
Points: 17
Post Options Post Options   Thanks (0) Thanks(0)   Quote davidsimmonds Quote  Post ReplyReply Direct Link To This Post Posted: 24 March 2006 at 10:42pm
9.81.
Back to Top
davidsimmonds View Drop Down
Newbie
Newbie


Joined: 16 December 2005
Status: Offline
Points: 17
Post Options Post Options   Thanks (0) Thanks(0)   Quote davidsimmonds Quote  Post ReplyReply Direct Link To This Post Posted: 24 March 2006 at 10:44pm
You have a 28x16 bitmap and it looks fine?
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 25 March 2006 at 7:24am

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
Back to Top
davidsimmonds View Drop Down
Newbie
Newbie


Joined: 16 December 2005
Status: Offline
Points: 17
Post Options Post Options   Thanks (0) Thanks(0)   Quote davidsimmonds Quote  Post ReplyReply Direct Link To This Post Posted: 25 March 2006 at 8:25am
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?
Back to Top
davidsimmonds View Drop Down
Newbie
Newbie


Joined: 16 December 2005
Status: Offline
Points: 17
Post Options Post Options   Thanks (0) Thanks(0)   Quote davidsimmonds Quote  Post ReplyReply Direct Link To This Post Posted: 03 April 2006 at 10:12am
No answer to the question?
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 03 April 2006 at 2:58pm

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
Back to Top
davidsimmonds View Drop Down
Newbie
Newbie


Joined: 16 December 2005
Status: Offline
Points: 17
Post Options Post Options   Thanks (0) Thanks(0)   Quote davidsimmonds Quote  Post ReplyReply Direct Link To This Post Posted: 03 April 2006 at 3:03pm
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.
Back to Top
davidsimmonds View Drop Down
Newbie
Newbie


Joined: 16 December 2005
Status: Offline
Points: 17
Post Options Post Options   Thanks (0) Thanks(0)   Quote davidsimmonds Quote  Post ReplyReply Direct Link To This Post Posted: 03 April 2006 at 3:05pm

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 bar

CXTPCommandBar* pMenuBar = pCommandBars->SetMenu(

_T("Menu Bar"), IDR_MAINFRAME);

if (pMenuBar == NULL)

{

TRACE0("Failed to create menu bar.\n");

return -1; // fail to create

}

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 03 April 2006 at 3:50pm

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
Back to Top
davidsimmonds View Drop Down
Newbie
Newbie


Joined: 16 December 2005
Status: Offline
Points: 17
Post Options Post Options   Thanks (0) Thanks(0)   Quote davidsimmonds Quote  Post ReplyReply Direct Link To This Post Posted: 03 April 2006 at 3:55pm
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?
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 04 April 2006 at 9:11am

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
Back to Top
davidsimmonds View Drop Down
Newbie
Newbie


Joined: 16 December 2005
Status: Offline
Points: 17
Post Options Post Options   Thanks (0) Thanks(0)   Quote davidsimmonds Quote  Post ReplyReply Direct Link To This Post Posted: 04 April 2006 at 9:15am
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?
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 04 April 2006 at 9:29am

Yes. menus first tring to find best bitmap in ImageManager if not found when it will resize exists.

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
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.172 seconds.