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 » CExtToolContorl question Collapse All
Subject Author Date
tera tera Jun 17, 2009 - 1:41 AM

Hello.


I made a menu dynamically before for approximately a half year.


After becoming Prof2.87

When the control that I stuck on a menu does Call of SetButtons,

Because delete of the control is carried out in Setbutton

The program did not work as before.

I am troubled.



http://ifreeta.dee.cc/20090617/SampleMuToolBar.lzh

Technical Support Jun 19, 2009 - 2:07 PM

The windows attached to the toolbar buttons must be destroyed by design of the CExtToolControlBar class. That is why we improved the CExtBarButton::~CExtBarButton() destructor in 2.87 because we don’t want the attached windows living inside the toolbar after changing its buttons or reinitializing the toolbar. This was the issue of 2.85 reported by several customers. So, the 2.87 works with windows attached to toolbar buttons correctly.

Technical Support Jun 17, 2009 - 9:16 AM

The source code is incomplete. The following include is missing:

#include "MTBASE\MtTempl.h"


tera tera Jun 17, 2009 - 6:33 PM
Technical Support Jun 18, 2009 - 1:20 PM

The CSampleMuToolBarDlg::OnButton***() methods in your test project invoke the CMuToolControlBar::DynCtrlMake() method which invokes the CExtToolControlBar::SetButtonCtrl() method. The problem is that the CWnd pointer specified in parameters of the CExtToolControlBar::SetButtonCtrl() method has the CWnd::m_hWnd property set to NULL. Please specify the CWnd pointers which have the valid subclassed window handles.


tera tera Jun 18, 2009 - 6:48 PM

Hello.


>The problem is that the CWnd pointer specified in parameters of the CExtToolControlBar-SetButtonCtrl method has the CWnd-m_hWnd property set to NULL.


In prof2.85, the sample works without a problem.

CWnd-m_hWnd becoming NULL , It is a phenomenon from prof2.87.

In destruct of the bar, I want the setting that CtrlSet is not called.


CExtBarButton::~CExtBarButton() { CExtAnimationSite * pAcAS = AnimationClient_SiteGet();  if( pAcAS != NULL )   pAcAS->AnimationSite_ClientRemove( this );  _DestroyMenu();  m_arrChildren.RemoveAll(); #if (!defined __EXT_MFC_NO_CUSTOMIZE) HDWP hPassiveModeDWP = NULL;  OnKeyTipTrackingQuery( false, NULL, hPassiveModeDWP ); #endif // from (!defined __EXT_MFC_NO_CUSTOMIZE)  CtrlSet( NULL, true ); // destroy attached window }


Give my best regards.


 

tera tera Jun 19, 2009 - 2:32 AM

In the following command, I seem to be able to cope somehow.

Is there a problem?


// ---------------------------------------------------------------------------- /**  *  @brief  */ // ---------------------------------------------------------------------------- CMuBarButtonBase::~CMuBarButtonBase() {  m_pCtrl = NULL; }

// ---------------------------------------------------------------------------- /**  *  @brief   BarButtonの  *  @param   nCmdID [in]  *  @param   nStyle [in]  *  @return CExtBarButton *  */ // ---------------------------------------------------------------------------- CExtBarButton * CMuToolControlBar::OnCreateBarCommandBtn(  UINT nCmdID,  UINT nStyle // = 0  ) {  ASSERT_VALID( this );  CExtBarButton * pTBB;  int iRec;    BOOL blFlag = FALSE;    TCmtMenuCtrl stMenuCtrl;

 pTBB = new CMuBarButtonBase( this, nCmdID, nStyle );

 ASSERT_VALID( pTBB );  return pTBB; }


Thanks,


 

tera tera Jun 21, 2009 - 6:13 PM

Hello.


I want an answer.

Is there any problem?


 


Thanks,


 

Technical Support Jun 23, 2009 - 8:32 AM

We added a new CExtBarButton::CtrlDetach() method:

virtual CWnd * CtrlDetach();

CWnd * CExtBarButton::CtrlDetach()
{
      ASSERT_VALID( this );
CWnd * pCtrl = m_pCtrl;
      m_pCtrl = NULL;
      return pCtrl;
}
Now you can detach the attached controls before reinitializing your toolbar.

tera tera Jun 17, 2009 - 7:19 PM

As for this program, ToolBar changes dynamically.


Programs always hold Window handles of the control that they made in array first

I assign it to ToolBar as needed.


    static CExtButton m_Btn1;

    m_Btn1.Create( "button control" ,     WS_CHILD|WS_VISIBLE     |BS_PUSHBUTTON     |BS_VCENTER     |BS_AUTOCHECKBOX     |BS_PUSHLIKE     ,     CRect(0,0, 60,20), &m_wndInnerBar, IDS_BUTTON1 );     m_Btn1.SetDrawBorder ( TRUE );     m_Btn1.SetTextColorNormal    ( COLORREF(RGB(0,0,0)) );     m_wndInnerBar.AddCtrlID( IDS_BUTTON1 );


However, from 2.87 in SetButtons of the bar, DestroyWindow of the control runs.

I do not want to work in DestroyWindow and delete of the control


 


void CExtBarButton::CtrlSet(
 CWnd * pCtrl,
 bool bCtrlAutoDestroyed
 )
{
 ASSERT_VALID( this );
 if( m_pCtrl != NULL )
 {
  if( ::IsWindow(m_pCtrl->GetSafeHwnd()) )
   m_pCtrl->DestroyWindow();
  if( ! m_bCtrlAutoDestroyed )
   delete m_pCtrl;
 }
 m_pCtrl = pCtrl;
 m_bCtrlAutoDestroyed = bCtrlAutoDestroyed;
#ifdef _DEBUG
 if( m_pCtrl != NULL )
 {
  ASSERT_VALID( m_pCtrl );
 }
#endif // _DEBUG
}

tera tera Jun 17, 2009 - 2:04 AM

 


I demand an answer as soon as possible

Give my best regards