Professional UI Solutions
Site Map   /  Register


Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » Icon does not show in cell Collapse All
Subject Author Date
Christian Herger Nov 10, 2009 - 8:55 AM

Hi there

I have a cell in which I only show an icon. I inherit from CExtGridWnd and did as follows:


    CExtCmdIcon* pIcon = new CExtCmdIcon();

    pIcon->AssignFromHICON(AfxGetApp()->LoadIcon(IDI_INPUT_ACTIVE), true);

    m_aImageIndexHwIndicator.Add(GridIconInsert(pIcon, -1, true));

    delete pIcon;

    pIcon = new CExtCmdIcon();

    pIcon->AssignFromHICON(AfxGetApp()->LoadIcon(IDI_INPUT_INACTIVE), true);

    m_aImageIndexHwIndicator.Add(GridIconInsert(pIcon, -1, true));

    delete pIcon;

    pIcon = new CExtCmdIcon();

    pIcon->AssignFromHICON(AfxGetApp()->LoadIcon(IDI_INPUT_UNDEFINED), true);

    m_aImageIndexHwIndicator.Add(GridIconInsert(pIcon, -1, true));

    delete pIcon;

    pIcon = 0;


and later use as follows:



        pCell = GridCellGet(HW, i, 0, 0);

        //Search the bitmap for HW indication

        int ulIndex = m_aImageIndexHwIndicator.GetAt(pInputOutput->GetPurpose()->GetStateAttribute()->GetValue());



            ulIndex = m_aImageIndexHwIndicator.GetAt(m_aImageIndexHwIndicator.GetCount() - 1);




but however, the cell(s) stay empty...

What am I missing here?

I also tried an CExtGridCellString but I think the Icon thing is implemented in the base class...

Ahh, I’m using v. 2.70


thanks for any input


Technical Support Nov 11, 2009 - 11:47 AM

All grid cells support icons. This feature is built-in and cannot be turned off without overriding virtual methods of grid cells, data provider and/or grid control. If the icons are not displayed, then there is something wrong with implementation of your grid related classes or their initializations. Could you please send us the source code of your grid related classes to the support mail box at this web site and we will check what’s wrong. We need to take a look at the grid control initialization code and any classes derived from Prof-UIS grid cells and grid controls.

Christian Herger Nov 12, 2009 - 1:44 AM

Ok now, it’s a little bit embarrassing The icon had an empty 32x32Bit image which was taken to show, obviously. Now I deleted it and the icon is shown. BUT it is streched to 32x32Bit and overlapps the cell! Originally it is only  15x13Bit. How can I prevent stretching?


Technical Support Nov 12, 2009 - 2:28 PM

There is not enough information in your message to come to any conclusion about the reported icon behavior. How did you delete it? Did you unregister it from the grid control? Did you reset the cells icon index to -1?

Christian Herger Nov 13, 2009 - 1:31 AM

No, sorry... As you know, an icon file (.ico) can contain many images. So I opened the icon file with an icon editor and found an empty 32x32Bit image which I then deletet within the icon file. The only image left in the icon file then was the one I needed with a size of 15x13Bit. After this the icons where visible in the grid but stretched to 32x32Bit. However, I now created a new 32x32Bit image and placed the smaller image in it. To me, this is a workaround but at least the icon is shown correctly now.

My question was only: can I tell the grid cell in what ’size’ an icon has to appear?

Thanks for your help and excuse my english if this is what caused the trouble

Technical Support Nov 14, 2009 - 2:14 PM

It’s not important how many images are stored in the .ICO file and it’s not important which size these images have. The LoadIcon() API always loads only a 32x32 image into the ICO handle. The LoadImage() API loads an icon image of the requested size and it probably uses some algorithm for finding an icon of the closest size to avoid scaling.

The Prof-UIS grid control does not scale icons. You should just load icons of requested size using the LoadImage() API, initialize the CExtCmdIcon objects from loaded HICON handles and register icons in the grid.

Technical Support Nov 10, 2009 - 2:33 PM

The icon indices can be assigned to any cell, including the basic CExtGridCell class. Please check whether you specified a valid icon index. Your code inserts 3 icons into the grid control. So, at least icon indices 0, 1 and 2 are valid. Please try to specify 0, 1 or 2 as icon index explicitly.

Christian Herger Nov 11, 2009 - 1:18 AM

Hi Technical Support

I’ve done this already by debugging and even changed the values then manually from 0 to 1 and 2. The indicies are stored correctly in m_aImageIndexHwIndicator (which besides is an array of int).

Any other suggestions?


PS: is there some sort of trick how to handle this editor? When I change the Style from ’Normal’ to ’Code’ or vice versa either nothing happens or the cursor jumps away or then it works after a couple of tries?????