Solved

CReBar and ActiveX Control

Posted on 2003-11-20
5
334 Views
Last Modified: 2013-11-20
Hi Guru's/Saints/Gods


I am using CReBar with a toolbar on it in my activex control. The problem is all the buttons are disabled on the toolbar. I think this could be because activex controls don't have message loop. I am sending WM_COMMAND message for the toolbar buttons from my main control and this enables buttons if I only use the toolbar on its OWN, however when I embed this toolbar inside a Rebar the buttons are grayed out....

please throw some light on this....I wonder what causes the buttons to get enabled when they are part of a rebar???

Many Thanks
0
Comment
Question by:devmentee
  • 4
5 Comments
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 9786498
Suppose m_wndToolbarCtrl is your CToolbarCtrl object

call

m_wndToolbarCtrl.EnableButton(nBuutonID, TRUE);

Good luck
0
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 9786509
>> think this could be because activex controls don't have message loop
Thats correct

Rosh :)
0
 

Author Comment

by:devmentee
ID: 9786579
Hi roshmon

I tried the following line where m_ToolBar is of type CToolBar...which compiles but I get the same result. ie my button is not enabled...
      m_ToolBar.GetToolBarCtrl().EnableButton(ID_MY_BUTTON, TRUE);

I then do  m_wndReBar.AddBar ( &m_ToolBar ) ;

Also let's say once I enable a button is there any handler which I have to implement to enable/disable buttons like you would ON_UPDATE_COMMAND_UI for a normal toolbar??


0
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 9786700
>> like you would ON_UPDATE_COMMAND_UI for a normal toolbar??

Ohh Yes

Call Like this


void CMainFrame::OnUpdateMyButton(CCmdUI* pCmdUI)
{
      pCmdUI->Enable(TRUE);

}

This can be a variable that control the enable/disable

pCmdUI->Enable(m_EnableDiable);


Rosh :)
0
 
LVL 23

Accepted Solution

by:
Roshan Davis earned 200 total points
ID: 9786704
Use the MACRO ON_UPDATE_COMMAND_UI_RANGE for a range of buttons
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
ORA-01403: no data found 43 106
windows 10 how make picture as desktop background 2 65
List out all word 7 317
Modbus - whats the maximum I can store in one register? 4 80
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question