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 » Ribbon Bar File Save As Collapse All
Subject Author Date
Andrew Banks Dec 27, 2006 - 11:53 PM

Ribbon Bar Sample.

File Save As

Instead of using something like the below in the sample:
                CExtRibbonNode * pNodeFileSaveAsFormat1 =
                    new CExtRibbonNode(
                        ID_FB_SAVE_AS_FROMAT_ICON,
                        ID_FB_SAVE_AS_FROMAT_ICON,
                        NULL,
                        __ECTN_BIG_ACCENT_IN_MENU|__ECTN_BOLD_IN_MENU,
                        NULL,
                        _T("Save Document As Format 1")
                        );
                pNodeFileSaveAsFormat1->SetTextMenuExtended(
                    _T("Save a copy of that will be fully compatible\nwith Format 1")
                    );
                VERIFY(
                    pNodeFileSaveAsFormat1->m_iconBig.m_bmpNormal.LoadBMP_Resource(
                        MAKEINTRESOURCE( ID_FB_SAVE_AS_FROMAT_ICON )
                        )
                    );
                pNodeFileSaveAsFormat1->m_iconBig.m_bmpNormal.Make32();
                pNodeFileSaveAsFormat1->m_iconBig.m_bmpNormal.AlphaColor( RGB(255,0,255), RGB(0,0,0), 0 );
                pNodeFileSaveAs->InsertNode( NULL, pNodeFileSaveAsFormat1 );

I would like the save as menu to be a collection of edit controls of which I need the data from all of them for a save as command.

Can you send me a sample that uses 2 edit controls/boxes and and 2 static boxes that identify those edit controls as well as maybe an OK button to indicate the save as command should be processed.

Technical Support Dec 28, 2006 - 1:38 PM

Please take a look at the Style menu in the menu bar in the StyleEditor sample. It has the Style, Font and Size combo box items. Each of them has a label on the left side of the combo box control’s area. It is possible to create the same edit boxes in menus. Is that what you need in the submenu displayed from the Save As item in the ribbon bar’s file menu?

Andrew Banks Dec 28, 2006 - 2:04 PM

Yes, I will play with it

Andrew Banks Dec 28, 2006 - 3:00 PM

Sorry, this isn’t going to work after all.

I want the ability of a dialog in the file save function where several edit controls need to be completed before the file save as command is executed. I was also hoping it would appear in the menu area.

That sample only allows one item to be completed and then the menu goes away.

Technical Support Dec 30, 2006 - 1:41 PM

The CExtPopupCtrlMenuWnd class is derived from CExtPopupMenuWnd and implements special kind of popup menu which contains one HWND-based child window instead of a set of classic menu items. The CExtPopupCtrlMenuWnd class is used as the base class for list-box menus, undo-redo menus and ribbon gallery menus. It is possible to code dialog container menu and use it anywhere in any menu tree but this task is tricky. Unlike dialog windows, menus never get system focus. So embedding dialog into menu is a kind of custom task. Please let us know why you need a dialog like menu with editors instead of a popup dialog?

Andrew Banks Dec 30, 2006 - 7:51 PM

I have decided that a ribbon bar interface wants to keep context rolling. I agree.
So, when I click a ribbon bar item and it represents more than a menu selection (dialog), I want to keep the user context close.

So, for example, I catch the following:
void CMainFrame::OnCommand1( )
{
    RECT rect ;
    CmdIDtoRect( ID_SHOW_HIDE_RULER, &rect ) ;
}

where:

int CMainFrame::CmdIDtoRect( UINT command_id, LPRECT lpRect )
{
    int index = m_wndRibbonBar.CommandToIndex( command_id ) ;
    m_wndRibbonBar.GetButtonRect( index, lpRect ) ;
    return( index ) ;
}

I now know the location of the ribbon button and can drop below the button a dialog based on the ribbon button’s rect location as above.

This way I maintain context. For example, I could use an Options button in the ribbonbar. It is clearly a dialog. By clicking it, the options dialog drops below the button. User Context is maintained. Maybe it should be in a file menu, maybe not.

Normally, a dialog would appear in the middle of the program screen and context is lost. I don’t like this.


So, my "file save as" command involves three edit controls and it is impossible to use a menu. Based on this fact, system or program focus is necessary because each of the 3 edit controls must be executed and delivered before focus is breached. But, I want to maintain context.

So, if you could tell me how I can get the coords of that list control to the right of the file menu, I will drop my own dialog on top of it. In addition, I can’t figure out where the OnClick is for the buttons in the file menu. I need that to know when to drop the dialog when the "File Save As" button is Clicked.

Take your time.
Many thanks,
Andrew Banks

Technical Support Jan 4, 2007 - 4:19 AM

It is hardly possible to display a modal dialog over a running menu window as you suggested. But it is possible to display a window when a menu item gets hovered by the mouse pointer (e.g. as it is demonstrated in the HelpNotes sample). The solution is a bit complicated. You should handle the CExtPopupMenuWnd::g_nMsgPrepareOneMenuLevel registered Windows message (see DRAWCLI and ProfUIS_Controls samples) and construct the ribbon’s File menu on the fly. It is a CExtRibbonGalleryPopupMenuWnd menu with TPMX_RIBBON_FILE_MENU in the value returned by the CExtPopupMenuWnd::TrackFlagsGet(). In your code, insert Save As popup menu item using CExtPopupMenuWnd::ItemInsertSpecPopup() and passing a pointer to the newly instantiated pop-up container. Such a container is a CExtPopupCtrlMenuWnd-derived class and in its CExtPopupCtrlMenuWnd::OnCreateChildControl() virtual method you can create a dialog window as the only child window of this container. Before the pop-up container is created, you should initialize CExtPopupCtrlMenuWnd::m_sizeChildControl in order to describe the desired dialog size.

There is an another approach to what you have to do. You could create the Save As menu item as a simple command item, which invokes a control bar somewhere on the left or on the right side of the main frame window. You could put all the necessary controls in the dialog that is a child of the control bar.