Professional UI Solutions
Site Map   /  Register
 
 

Forum

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 Tech Support » Hello Collapse All
Subject Author Date
Artur Shingirei Dec 14, 2004 - 1:26 AM

I has just been upload new version 2.27
And I meets with problem:

I create toolbar on the dialog and set the transparent color :

    g_CmdManager->UpdateFromToolBar(

GetApp()->m_pszRegistryKey,
IDR_BAR1,
NULL,
NULL,
false,
true,
RGB(255,255,255));

When dialog is appeared the transparent color do not set. When I used 2.25 version of Prof-UIS all was OK.
Thank You.

Technical Support Dec 14, 2004 - 6:17 AM

We may guess that you update the images (extracted from IDR_BAR1) that stored in the command manager twice. Furthermore, if you used the default grey color as transparent instead of white, you would not have encountered this situation. So, let see what’s happened.

In version 2.27, to allow the developers to change language-dependant resources on-the-fly (at runtime), the algorithm responsible for updating images in the command manager has been modified. This feature became possible with a new component called "Resource Manager". Any multilingual application that requires on-the-fly language switching may need the reloading of toolbar images. So, now all images are forcedly updated each time when you update the command manager with data from a toolbar.

First time your application puts the toolbar commands to the command manager when it invokes g_CmdManager->UpdateFromToolBar. After this step, the images in the command manager are valid and based on the white color as transparent as you specified. The second time, when CExtToolControlBar::LoadToolBar method is called, the command manager is updated with the same commands. At this step, the images are completely replaced. But this method uses the default grey color as transparent. It is not difficult to improve your code. Please use the following code snippet:

LPUINT pArrButtonsIDs = NULL; 
INT nButtonCount = 0;
VERIFY(
    g_CmdManager->UpdateFromToolBar(
        pApp->m_pszProfileName,
        IDR_BAR1,
        &pArrButtonsIDs,
        &nButtonCount,
        true,
        true,
        RGB(255,255,255)
        )
    );
ASSERT( pArrButtonsIDs != NULL && nButtonCount > 0 );
if(    (! m_wndToolBar.Create( NULL, this, AFX_IDW_TOOLBAR ) )
    || (! m_wndToolBar.SetButtons( pArrButtonsIDs,
                                   nButtonCount ) )
    )
{
    ASSERT( FALSE );
    delete [] pArrButtonsIDs;
    return -1;
}
delete [] pArrButtonsIDs;