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 » About CExtToolControlBar Collapse All
Subject Author Date
tera t May 14, 2007 - 3:09 AM

Hi

I do not want to use LoadToolbar in CExtToolControlBar

When direct want to take out BarButton.
I want to dynamic change of BarButton in ControlBar

Is a program good in the following form?

HICON hIcon;
hIcon =
(HICON)::LoadImage(
hInstResource,
MAKEINTRESOURCE( IDI_ICON ),
IMAGE_ICON,
32, 32, LR_VGACOLOR
);
m_pCmdIconBox = new CExtCmdIcon;

CExtCmdItem _cmd;
_cmd.m_nCmdID = IDS_BARBUTTON;

ASSERT( CExtCmdManager::IsCommand( _cmd.m_nCmdID ) );
pProfile->CmdSetup ( _cmd, false );
m_pCmdIconBox->AssignFromHICON( hIcon , TRUE );
pProfile->CmdSetIcon ( _cmd.m_nCmdID, m_pCmdIconBox , true );

m_toolbarBar.SetButtons( IDS_BARBUTTON , 1 );

Technical Support May 14, 2007 - 8:31 AM

Here is the declaration of SetButtons()

BOOL SetButtons(
    const UINT* lpIDArray,
    int nIDCount 
    );
The method puts the controls specified by the lpIDArray pointer in the toolbar. It completely removes all the previous buttons. So if you need to change the specific button only, you should not use this method. You should use the InsertButton() and RemoveButton() methods instead.


tera t May 14, 2007 - 6:36 PM

Hi

It is not possible for an allotment of an icon in InsertButton.

I send a sample program.
Is there the issue of anything?

Thanks,

Technical Support May 15, 2007 - 10:19 AM

The toolbars and menus do not contain any icons. They get icons from the command manager. We have received your project and it’s OK. Do we need check for something else?

tera t May 15, 2007 - 6:09 PM

Hi

>They get icons from the command manager.
I did not understand structure well.

>We have received your project and it’s OK.

Thanks,

Technical Support May 16, 2007 - 9:49 AM

The structure is very simple:

1) The toolbar contains only command identifiers of its buttons.

2) The global command manager contains a set of command profiles. Each command profile is attached to one or more windows (typically there is only one profile, which is attached to the main frame). The command profile contains an array of command descriptions. Each command descriptions contains an identifier, flags, text in toolbar, text in menu, tool tip, status tip and icon.

How can toolbar find icon when it knows only the buttons command identifier? First of all, the toolbar should find its command profile in the command manager. It can be found using toolbar’s window handle. If there are no command profile in the command manager attached to toolbar handle, then it gets toolbar’s parent window and searches for its command profile and so on. In the typical case, walking through parent window chain is stopped at the main frame window which is attached to the command profile in the command manager. The command profile contains map from the command identifier to the CExtCmdItem command description object which includes all the required information about the command including its icon.