Solved

CReBar and ActiveX Control

Posted on 2003-11-20
5
331 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

707 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now