?
Solved

CReBar and ActiveX Control

Posted on 2003-11-20
5
Medium Priority
?
339 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 800 total points
ID: 9786704
Use the MACRO ON_UPDATE_COMMAND_UI_RANGE for a range of buttons
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

770 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