Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-swt-dev] OLE Win32 - Menu issues with OleControlSite


Hi experts,
This is regarding the Bug Id. 299241 regarding menu issues with OleControlSite.

Opening a view with an OleControlSite and closing it wipes away the shell menu bar (see bugzilla for details on how to reproduce the error). We've observed that the same does not happen with OleClientSite. So I compared both the classes and was able to see the difference in the 'OnUIDeactivate(int fUndoable)' method.

The OleClientSite contains the following extra code in its OnUIDeactivate method:
    Menu menubar = shell.getMenuBar();
    if (menubar == null || menubar.isDisposed())
        return COM.S_OK;
       
    int /*long*/ shellHandle = shell.handle;
    OS.SetMenu(shellHandle, menubar.handle);
    return COM.OleSetMenuDescriptor(0, shellHandle, 0, 0, 0);
 
But the OnUIDeactivate method in the OleControlSite does not contain this (there's a comment, though)
protected int OnUIDeactivate(int fUndoable) {
    // controls don't need to do anything for
    // border space or menubars
    if (frame == null || frame.isDisposed()) return COM.S_OK;
    state = STATE_INPLACEACTIVE;
    frame.SetActiveObject(0,0);
    redraw();
    Shell shell = getShell();
    if (isFocusControl() || frame.isFocusControl()) {
        shell.traverse(SWT.TRAVERSE_TAB_NEXT);
    }
    return COM.S_OK;
}

For testing purposes, I added the missing menu bar related code to the OleControlSite class and tested our view. This time we did not have any problem; the menus stay even after closing the view.

However, since it is clear that the SWT OLE team deliberately left out this menu related code in OleControlSite, we are worried if adding this in OleControlSite might cause other issues.
Can anyone elaborate the comment '// controls don't need to do anything for border space or menubars' ?

Is it ok to add the OS.SetMenu and OS.OleSetMenuDescriptor calls in the OleControlSite's OnUIDeactivate method?

 
Thank you
Satish



The INTERNET now has a personality. YOURS! See your Yahoo! Homepage.

Back to the top