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 General Discussion » CExtDynamicControlBar in a SDI appliction. Collapse All
Subject Author Date
Stephane Leger May 27, 2008 - 8:01 AM

Hi,


I need your advice on using your CExtDynamicControlBar in an SDI application. I am developing a application for a control system. I must control the access to the docking/hide/destruction of the different bars in the application. To do that up to now I control the availability of the NcButtons using the virtual methods you provide and it is working fine. The problem I face now is to do the same thing when the control bar is in the SDI document tab control (__EDBS_DOCUMENT state).


How can I enable or disable the close button on the tab easily?


Another feature I need to do is to show the option popup menu on the left mouse double clicks. I done it when the CExtDynamicControlBar is in docking state but it is not working in floating or in Document state. I need to implement this because we are using large touch screen display without keyboard or special input device. So we must provide all the functionalities using only mouse left click.


How can I handle the left double click on the tab and in the floating state to show the option popup menu?


Do you have a simple way doing it?


 I had to copy a lot of your code to get it working in docking state. I am sure I am not approaching the problem correctly. Please provide me some advice.


Thanks for your help!


Stephane.

Stephane Leger May 28, 2008 - 8:10 AM


Hi,




Thanks for the answer. Sorry if I am late to answer your question I had to study the behavior of the Dynamic control bar in a tabbed bar group. So the answer is yes I will need to handle the double left click to show the menu on the tab or at least disable the undocking from the group and also on the title bar of the tabbed bar group. I know that I can use your button in the title but on a large screen display using your finger during fire fighting exercise you need to move very fast and clicking on a small button is not always easy!



I have another question, at the moment we manage multi screen machine. So our approach at the moment is to use an SDI application with multiple main frames (one per screen). At the moment, it is working fine, but one of the limitations is that we can’t dock a bar from one frame (screen) to the other frame (screen). This is because we have 2 docking sites. We decide to live with it. 


So the question is:




Do you see a way to be able to transfer a bar from one docking site to the other one without rewriting everything?


Thanks for your support.



 Stephane.

Technical Support May 29, 2008 - 4:11 AM

You can implement the following virtual method in your class representing a control bar:

      virtual bool _FloatStateChangingIsEnabled( const CExtControlBar * pBarQuerySrc ) const;
If this method returns false, the bar cannot be switched into the floating state. The CExtControlBar::_DraggingGetBar() static method returns a pointer to the control bar which is currently being drag-n-dropped. So, you can detect when the _FloatStateChangingIsEnabled() virtual method is invoked.

Unfortunately there are no virtual methods in the CExtControlBar class that would allow you to handle double clicks on tab items and the caption of the floating mini frame. But it’s possible to limit any re-docking behavior of the bar. If you need explicitly receive double click events, we can develop appropriate APIs and provide you with the source code update.

The re-dockable control bars in both MFC and Prof-UIS are very linked to one instance of the frame window which is also called dock site. Besides, the state persistence of Prof-UIS control bars requires the exact match between the states of the ontrol bars saved in serialized state data and the control bars created in the frame window. You can implement some special caption button displaying a popup menu or a caption context menu related to each of your bars. These menu should contain commands for moving control bars into different frames on your desktops. The dynamic resizable control bars can be simply de-allocated in one frame window and allocated in another.

Technical Support May 27, 2008 - 2:02 PM

The CExtDynamicBarSite::OnTabPageContainerClickedButton() virtual method is called when the "X"-button is invoked inside the tab item which corresponds to the dynamic resizable bar in document state and the nHitTest parameter is set to __ETWH_BUTTON_CLOSE. So, you can block clicking on the "X" buttons. If you need to hide "X"-buttons inside tab items for particular resizable control bars in the document mode, you should implement the CExtDynamicControlBar::OnMoveChildToDocument() virtual method which is invoked when the bar is switched into document mode. Your method should look like as follows

void CYourBar::OnMoveChildToDocument()
{
      ASSERT_VALID( this );
      ASSERT( GetSafeHwnd() != NULL );
      //
      // invoke parent class method
      //
      CExtDynamicControlBar::OnMoveChildToDocument();
      //
      // analyze whether everything is OK now, avid destruction issues
      //
HWND hWndChild = OnQueryChildHWND();
      if( hWndChild == NULL )
            return;
CExtDynamicBarSite * pDBS = GetBarSite();
      if( pDBS == NULL )
            return;
      //
      // this method is related to SDI environment only
      //
CExtDynamicBarSite::eDetectedUiType_t eDUIT = pDBS->GetDetectedUiType();
      if( eDUIT != CExtDynamicBarSite::__EDUIT_SDI_TAB_PAGE_CONTAINER )
            return;
CExtTabPageContainerWnd * pWndTabPageContainer =
            pDBS->GetTabPageContainer();
      ASSERT_VALID( pWndTabPageContainer );
      //
      // find appropriate tab item in the tab control inside tab page container window
      //
CExtTabWnd * pWndTabs = pWndTabPageContainer->GetSafeTabWindow();
      ASSERT_VALID( pWndTabs );
LONG nItemIndex = pWndTabs->ItemFindByLParam( LPARAM(hWndChild) );
      if( nItemIndex < 0L )
            return;
CExtTabWnd::TAB_ITEM_INFO * pTII = pWndTabs->ItemGet( nPageIdx );
      ASSERT( pTII != NULL );
      //
      // disable "X" button inside this tab item
      //
      pTII->ModifyItemStyleEx( __ETWI_EX_NO_CLOSE_ON_TAB );
      if( pWndTabs->IsWindowVisible() )
            pWndTabs->Invalidate();
}
We need more details about the left button double click event you want to handle? Do you need it for tab items inside a tabbed bar group?

Stephane Leger May 28, 2008 - 2:12 PM

Hi,


I have another problem but this one I am sure you face it before but we are not able to find anything on the forum. We have created inside a Dymamic control bar a child dialog. In the dialog we insert a CtreeCtrl and we added some items. When the bar is docked or floating or in the SDI document everything work as expected. When we set the bar in Auto Hide state the moment we left click on a item, we have a assert in the  CExtDynAutoHideSlider::_HookMouseProc her the stack trace:


  ntdll.dll!7c901230()  

  [Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll] 

> msvcr80d.dll!_CrtDbgBreak()  Line 89 C

  msvcr80d.dll!_VCrtDbgReportA(int nRptType=2, const char * szFile=0x782e5758, int nLine=892, const char * szModule=0x00000000, const char * szFormat=0x00000000, char * arglist=0x00138c00)  Line 290 C

  msvcr80d.dll!_CrtDbgReportV(int nRptType=2, const char * szFile=0x782e5758, int nLine=892, const char * szModule=0x00000000, const char * szFormat=0x00000000, char * arglist=0x00138c00)  Line 300 + 0x1d bytes C

  msvcr80d.dll!_CrtDbgReport(int nRptType=2, const char * szFile=0x782e5758, int nLine=892, const char * szModule=0x00000000, const char * szFormat=0x00000000, ...)  Line 317 + 0x1d bytes C

  mfc80ud.dll!AfxAssertFailedLine(const char * lpszFileName=0x782e5758, int nLine=892)  Line 25 + 0x14 bytes C++

  mfc80ud.dll!CWnd::AssertValid()  Line 892 + 0x3f bytes C++

  ProfUIS282ud.dll!CExtDynAutoHideSlider::AssertValid()  Line 903 C++

  mfc80ud.dll!AfxAssertValidObject(const CObject * pOb=0x06cf8920, const char * lpszFileName=0x01aa1bac, int nLine=4651)  Line 107 C++

  ProfUIS282ud.dll!CExtDynAutoHideSlider::_HookMouseProc(int nCode=0, unsigned int wParam=162, long lParam=1281708)  Line 4652 C++


 


Look like the g_pHookTarget handle is not valid in the method:



LRESULT



CALLBACK CExtDynAutoHideSlider::_HookMouseProc(


int nCode, // hook code = 0

WPARAM wParam, // message identifier =162

LPARAM lParam // mouse coordinates = 1281708

)


To give you a bit more info the dialog with the tree is in a DLL (Not an extension one). The parent of the dialog is of course the Dynamic control bar.


Thanks.


Stephane.




Technical Support May 29, 2008 - 11:39 AM

We need some more details about your DLL:

- Is it MFC regular DLL, ATL/WTL or generic Win 32 DLL?
- If it is MFC regular DLL, whether it uses Prof-UIS and which configuration of Prof-UIS?

Stephane Leger May 29, 2008 - 2:46 PM

It is a MFC regular DLL. We added the __PROF_UIS_FOR_REGULAR_DLL in the Preprocessor definition and we added

the CExt_ProfUIS_ModuleState::InitExtension( AfxGetStaticModuleState() ); in the CHmiBasicPluginsApp::InitInstance().

 But at the beggininig when the problem occured we didn’t have it we added these definition after digging the problem

but that do not solved it. So that link with profuis82ud-RDE.lib.


What is maybe special is that my dll implement the child dialog and create it. We passed the CExtDynamicControlBar

handle created in the main application to it. So to be clear


- The CExtDynamicControlBar is created in the executable.

- The executable call in the dll and passed the CExtDynamicControlBar safe handle to the dll

- The Dll created the child dialog ( that contain the CTreeCtrl ) using the CExtDynamicControlBar safe handle as parent.

- The executable dock the dynamic control bar.


In the dll we try to use a simple CDialog, we try also the CExtResizableDialog, we try also the CExtWFF template with the CTreeCtrl.

The assert happen before any CTreeCtrl handler is called (OnTvnSelchangedNavToolTree or OnTvnItemExpandingNavToolTree).


It is happening only when the control bar is in auto hide state. In all other states it is working fine!


Thanks!


Stephane.