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 » Toolbar not in context menu Collapse All
Subject Author Date
Christopher Favreau Jul 28, 2006 - 2:22 PM

I started a MDI using the Prof-UIS wizard in Visual Studio 6 Now I want to add the UI selector toolbar. Then I added the CExtThemeSwitcherToolControlBar m_wndToolBarUiLook; Then I edited CMainFrame::OnCreate and the toolbar shows up and is dockable. What steps to I take to get the context menu filled out properly so I can redisplay the toolbar if it has been hidden previously.

Also, I don’t think your search function works very well. So this information could be on site already I just couldn’t find it.

Thank you in advance for your time,
Seth

Suhai Gyorgy Jul 29, 2006 - 3:33 AM

Check out the thread "context menu for a list of control bars". It’s te 3rd below yours. That thread might have the answer to your question:

--- Quote ---

A control bar is not displayed in context menus only if Prof-UIS cannot find the display name of this control bar. This is true for control bars of all types. The display name can be one of the following:

1) The window text of the control bar specified when it is created with CExtControlBar::Create().

2) The text of the menu item which has the same command identifier as the control bar’s dialog control identifier specified when it is created with CExtControlBar::Create(). Typically this menu item is used for showing/hiding the control bar.

--- end Quote ---

Regards: Chris

Seth Strong Jul 31, 2006 - 9:19 AM

Here, I’ll add the related code from OnCreate(). I figure whatever I need to do, it’s likely to be done there. This is wizard generated except for the addition of the UI Selector.


// The UI Selector is m_wndToolBarUiLook of type CExtThemeSwitcherToolControlBar
    if(        (! m_wndToolBarUiLook.Create( NULL, this, ID_VIEW_UI_LOOK_BAR ) )
        ||    (! m_wndToolBarUiLook.ThemeSwitcherInit() )
        )
    {
        TRACE0("Failed to create m_wndToolBarUiLook toolbar\n");
        return -1; // fail to create
    }
.
.
.
    m_wndToolBarUiLook.EnableDocking( CBRS_ALIGN_ANY );

//    DockControlBar( &m_wndToolBarUiLook );

// I’m not really sure if I should add something here or not
static UINT statBasicCommands[] =
{
    ID_FILE_NEW,
    ID_FILE_OPEN,
    ID_FILE_SAVE,
    ID_APP_EXIT,
    ID_APP_ABOUT,
    ID_FILE_PRINT,
    ID_FILE_PRINT_SETUP,
    ID_EDIT_COPY,
    ID_EDIT_CUT,
    ID_EDIT_PASTE,
    ID_EDIT_UNDO,
    ID_VIEW_TOOLBAR,
//    ID_VIEW_UI_LOOK_BAR,
    ID_VIEW_RESIZABLEBAR_EMPTY,
    ID_VIEW_RESIZABLEBAR_TREE,
    ID_VIEW_RESIZABLEBAR_EDIT,
    ID_VIEW_RESIZABLEBAR_CP,
    ID_VIEW_RESIZABLEBAR_DLG,
    ID_WINDOW_TILE_HORZ,
    0 // end of commands list
}; // statBasicCommands array

    

Seth Strong Jul 31, 2006 - 9:10 AM

The context menu displays a greyed out option "UI Selector". Why is it grey?

Technical Support Jul 31, 2006 - 10:42 AM

Please make sure your CMainFrame::PreTranslateMessage() method starts with the following code:

BOOL CMainFrame::PreTranslateMessage( MSG * pMsg) 
{
    if( m_wndToolBarUiLook.PreTranslateMessage( pMsg ) )
        return TRUE;


Seth Strong Jul 31, 2006 - 11:50 AM

I found the missing piece.

To add the UI Selector, I made it a member of CMainFrame. I initialized it in OnCreate() and EnabledDocking() for it. Then (this part I left out) I map in the messages with ON_COMMAND_EX(SELECTOR, OnBarCheck) and ON_UPDATE_COMMAND_UI(UI_SELECTOR_ID,OnUpdateControlBarMenu).

Thanks,
Seth