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 » CExtTabMdiWhidbeyWnd Collapse All
Subject Author Date
Sergio Buonanno Apr 20, 2006 - 7:04 AM

I have a MDI application with tabbed MDI childs. In CMainFrame::OnCreate I have the following code:

if(!m_wndMdiTabs.Create(this, CRect( 0, 0, 0, 0 ), UINT( IDC_STATIC ),    WS_HSCROLL | WS_VSCROLL | WS_CHILD | WS_VISIBLE |
            WS_CLIPSIBLINGS,
            __ETWS_ENABLED_BTN_CLOSE | __ETWS_SHOW_BTN_CLOSE |
            __ETWS_MDI_DEFAULT | __ETWS_ORIENT_TOP | __ETWS_AUTOHIDE_SCROLL |
            __ETWS_ITEM_DRAGGING | __ETWS_BOLD_SELECTION | __ETWS_HIDE_ICONS)
            //PUIS_TABWINDOWFROMDI - $$__PROFUISAPPWIZ_KEY_ADF_MDITABS$$
        )
    {
        ASSERT( FALSE );
        return -1;
    }
    m_wndMdiTabs.ModifyTabWndStyle( 0, __ETWS_SHOW_BTN_TAB_LIST | __ETWS_ENABLED_BTN_TAB_LIST);

I don’t know why, but the MDI tab close button appears disabled. If I click on it works (the child window is correctly closed). Is there something I can do to fix this issue ?

Sergio Buonanno Apr 26, 2006 - 7:44 AM

Ok. Problem fixed. Thank you. The style WS_SYSMENU was missing and I discovered Prof-UIS checks if System Menu exists.

Sergio Buonanno Apr 26, 2006 - 6:50 AM

The close button is not disabled and if I remove the TAB control using my application as a standard MDI aplication everything works fine. I think that for what ever reason there is something that disables the button, but I didn’t succeed to understand what.

Technical Support Apr 20, 2006 - 11:45 AM

The close button is disabled only when the close button of the child frame is disabled. There was a bug when you were able to close such a child frame window using the disable tab close button. We already fixed this bug. Please find the OnTabWndClickedButton method in the CExtTMWI template and replace it with this:

 virtual bool OnTabWndClickedButton(
  LONG nHitTest,
  bool bButtonPressed,
  INT nMouseButton, // MK_... values
  UINT nMouseEventFlags
  )
 {
  if( nMouseButton != MK_LBUTTON )
   return false;
#if (!defined __EXT_MFC_NO_CUSTOMIZE)
  CExtCustomizeSite * pSite =
   CExtCustomizeSite::GetCustomizeSite( m_hWnd );
  if(  pSite != NULL
   && pSite->IsCustomizeMode()
   )
   return false;
#endif // (!defined __EXT_MFC_NO_CUSTOMIZE)
  bool bRetVal =
   _BT::OnTabWndClickedButton(
    nHitTest,
    bButtonPressed,
    nMouseButton, // MK_... values
    nMouseEventFlags
    );
  DWORD dwStyle = GetTabWndStyle();
  if(  (!bButtonPressed)
   && ( ( nHitTest == __ETWH_BUTTON_CLOSE && (dwStyle&__ETWS_ENABLED_BTN_CLOSE) != 0 )
    || ( nHitTest == __ETWH_BUTTON_HELP && (dwStyle&__ETWS_ENABLED_BTN_HELP) != 0 )
    )
   && SelectionGet() >= 0
   )
  { // if "X" or "?" pressed
   TAB_ITEM_INFO * pTii = SelectionGetPtr();
   ASSERT_VALID( pTii );
   HWND hWndMdiChild = (HWND)pTii->LParamGet(); 
   if( hWndMdiChild != NULL && ::IsWindow(hWndMdiChild) )
   {
    PostMessage( WM_CANCELMODE );
    if( nHitTest == __ETWH_BUTTON_CLOSE )
    { // if "X" pressed
     POINT point = { 0, 0 };
     ::GetCursorPos( &point );
     ::PostMessage(
      hWndMdiChild,
      WM_SYSCOMMAND,
      SC_CLOSE,
      MAKELONG( point.x, point.y )
      );
//      PostMessage(
//       WM_TIMER,
//       __EXTTAB_MDI_UPDATE_TIMER_ID_2,
//       0
//       );
    } // if "X" pressed
    else
    { // if "?" pressed
     CPoint ptCursor( 0, 0 );
     ::GetCursorPos( &ptCursor );
     VERIFY( ::ClientToScreen( hWndMdiChild, &ptCursor ) );
     ::PostMessage(
      hWndMdiChild,
      WM_SYSCOMMAND,
      SC_CONTEXTHELP,
      MAKELONG( ptCursor.x, ptCursor.y )
      );
    } // if "?" pressed
   } // if( hWndMdiChild != NULL && ::IsWindow(hWndMdiChild) )
  } // if "X" or "?" pressed
  return bRetVal;
 }