Solved

CReBar and ActiveX Control

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

920 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