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 » Set focus to a toolbar combo Collapse All
Subject Author Date
Neville Franks Jun 30, 2004 - 1:26 AM

Hi,
How do I programmatically set focus to a combobox on a toolbar. eg. In the StyleEditor sample how would I set focus to the Font Selection combo from code in my CMainFrame?


Thanks,
Neville

Technical Support Jun 30, 2004 - 3:36 AM

Dear Neville,

First, you need to get a pointer to the CExtBarButton object which implements the button in toolbar (with the help of CExtToolControlBar::GetButton). Then use the DYNAMIC_DOWNCAST macro to try and get a pointer to the CExtBarTextFieldButton object. If it is not NULL, the button is a text field or a combo field. Then activate the in-place editor by invoking the CExtBarTextFieldButton::OnInplaceControlRun method. Please do not forget to check whether the field button is visible (with CExtBarButton::IsVisible).

Neville Franks Jun 30, 2004 - 3:30 PM

>Please do not forget to check whether the field button is visible (with CExtBarButton::IsVisible).


Can you tell me how a toolbar button/combo can become !Visible? I’ve added:

	    if ( !pEBB->IsVisible() )
		    pEBB->Show( true );

and even if I hide the toolbar with the combo button CExtBarButton::IsVisible() returns true.


Thanks,
Neville

Technical Support Jul 1, 2004 - 7:54 AM

The CExtBarButton::ModifyStyle method allows you to forcibly make the button visible/invisible by setting/removing the TBBS_HIDDEN button style. The CExtBarButton::IsVisible method just returns true if the button is displayed inside toolbar’s client area or false if the button is temporarily hidden inside the chevron menu. You should not use the CExtBarButton::Show method because it is designed for the internal use only (it is used when the toolbar calculates a subset of visible buttons in its client area). To check the button’s visibility, do the following:


  • check the toolbar’s visibility with the CControlBar::IsVisible method: if the toolbar is not visible, you may show it by calling CFrameWnd::ShowControlBar method or sending the WM_COMMAND message with the dialog control identifier as WPARAM to the frame window

  • if the toolbar is visible, check whether the TBBS_HIDDEN button style is excluded to ensure that the button can be "physically" visible

  • check the button visibility with the CExtBarButton::IsVisible method: if the button is not visible, then it is hidden in the chevron menu

Neville Franks Jun 30, 2004 - 4:44 AM

Thanks for your help, I’ve got it working.


Neville