Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

CRebar in a Dialog Box.. Possible or need CFrameWnd?

Posted on 1999-07-28
9
Medium Priority
?
394 Views
Last Modified: 2013-11-20
Is it possible to put a CRebar control in a plain ol' Dialog box? I tried using the sample code in MFCIE to do this, but it seems like I need to do this in a CFrameWnd.
0
Comment
Question by:flandango
[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
  • 5
  • 4
9 Comments
 
LVL 23

Expert Comment

by:naveenkohli
ID: 1311826
What problem you had when u tried using this in dialog box.
0
 

Author Comment

by:flandango
ID: 1311827
The Rebar didn't show up at all. No assertion errors or anything.. just a missing bar
0
 

Author Comment

by:flandango
ID: 1311828
Adjusted points to 150
0
Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

 
LVL 23

Expert Comment

by:naveenkohli
ID: 1311829
Can u post the portion of the code where you created the bar, may be its just a simple mistake?
Check the docking of your bar..

0
 

Author Comment

by:flandango
ID: 1311830
This is what I did (in the same project as MFCIE)
The code is basically identical as the code that creates the rebar in the mainframe. It's called in CMainFrame::OnCreate, and does what I want to see, and I call it in my CCustomDlg::OnCreate. For some reason it doesn't show up in the dialog... perhaps there is some style I need to apply or something?
--
(in the OnCreate() of my dialog box, which I create with DoModal)


CImageList img;
      
      if (!m_reBar.Create(this))
      {
            TRACE0("Failed to create rebar\n");
            return -1;      // fail to create
      }

      if (!m_toolBar.CreateEx(this))
      {
            TRACE0("Failed to create toolbar\n");
            return -1;      // fail to create
      }
      // set up toolbar properties

      m_toolBar.GetToolBarCtrl().SetButtonWidth(50, 150);
      m_toolBar.GetToolBarCtrl().SetExtendedStyle(TBSTYLE_EX_DRAWDDARROWS);

      img.Create(IDB_HOTTOOLBAR, 22, 0, RGB(255, 0, 255));
      m_toolBar.GetToolBarCtrl().SetHotImageList(&img);
      img.Detach();
      img.Create(IDB_COLDTOOLBAR, 22, 0, RGB(255, 0, 255));
      m_toolBar.GetToolBarCtrl().SetImageList(&img);
      img.Detach();
      m_toolBar.ModifyStyle(0, TBSTYLE_FLAT | TBSTYLE_TRANSPARENT);
      m_toolBar.SetButtons(NULL, 9);

  m_reBar.AddBar(&m_toolBar);


0
 
LVL 23

Expert Comment

by:naveenkohli
ID: 1311831
try this...

1.Move this code into OnInitDialog function..make sure that you do this creation of bar routine after call to base class function i.e.
CDialog::OnInitDialog ()

2. And at the end of function, place the tool bar..

      RepositionBars (AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);

Try it ...

Good Luck!
0
 

Author Comment

by:flandango
ID: 1311832
All right! It works! Thanks a lot.
Go ahead and post that as an answer and I'll give you the points.
0
 
LVL 23

Accepted Solution

by:
naveenkohli earned 800 total points
ID: 1311833
Thankx!
0
 

Author Comment

by:flandango
ID: 1311834
All right! It works! Thanks a lot.
Go ahead and post that as an answer and I'll give you the points.
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
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…
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.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

715 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