Solved

CbitmapButton on CDialogBar

Posted on 2000-04-01
8
598 Views
Last Modified: 2013-11-20
Can i put a CBitmapBUtton on my CDialogBar.

Becoz i didn't derive any class from CDialogBar and all i did was create a variable of Type CDialogBar and Create() from the dialog that ive created earlier. Within the dialog ive dragged and drop several buttons and comboboxes...

Now i have no idea how to change the buttons into a CbitmapButton becoz i dunno where i shud place the AutoLoad function to load the appropriate Bitmaps?

0
Comment
Question by:lamer
[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
  • 3
  • 3
  • 2
8 Comments
 
LVL 30

Expert Comment

by:Axter
ID: 2677578
1. Open your dialog via the resource editor.
2. Right-Mouse click your button.
3. Select properties from the pop-down menu.
4. The properties screen will popup.
5. Click the "Styles" tab.
6. Set the "Owner draw" and the "Bitmap" fields.
7. Click the "General" tab, and make sure the "Visible" field is set.
8. Press Ctrl-W
9. Click the Member-Variables Tab
10. Double click the ID of your button (IDC_BUTTON1) listed under the controls Ids
11. The "Add-Member Variable" form will popup.
12. In the Member-Variable-Name field, enter the name of your new control variable. (Example: m_MyButtonControl)
13. Click OK.
14. Click OK on the Class Wizard.
15. Open your Dialog.H (Header) file.
16. Find your new variable between the "AFX_DATA".  Something like "CButton       m_MyButtonControl ;"
17. Change the CButton to CBitmapButton.
18. Open your dialog CPP file.
19. On the constructor, add your LoadBitmaps function.  (Example: m_MyButtonControl.LoadBitmaps(IDB_BITMAP1,IDB_BITMAP2,IDB_BITMAP3,IDB_BITMAP4);

That's it.
0
 
LVL 30

Expert Comment

by:Axter
ID: 2677586
I'm sorry Lamer,
I obviously gave you instructions for creating a CBitmapButton on a Dialog class, and not a CDialogBar.
I didn't realize your question was on a CDialogBar until after I submitted the comment.
0
 

Author Comment

by:lamer
ID: 2678505
Yeah, i noticed... :)

So now i am just wondering which one is easier...

Using a CToolBarCtrl to add CComboBoxes..(BitmapButtons are already supported natively) or using a CDialogBar with CBitmapButtons? if so plz do give some sample source.
0
[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

 
LVL 10

Expert Comment

by:RONSLOW
ID: 2678603
Answer 1: derive your own class from CDialogBar and do the DDX_Control etc from there.

Answer 2: there is sample code out there for combo boxes in toolbars.  MSJ has code/articles (if you have MSDN) and www.codeguru.com should help you out as well.

If all you want is a bunch of buttons and a combo box, then I think using a toolbar with a combo box on it is best (you get all the nice resizing etc of tool bars).

If there is more to it, then go for a CDialogBar derived class.

Alternatively, use Rebar cotrols, which let you put whatever you like in the bars.  But they have other limitations.

Again, check out MSJ and Codeguru for examples and discussions about these issues and decide what one bets suits your particular requirements and which you like the most.

0
 

Author Comment

by:lamer
ID: 2799042
DDX_COntrol on CBItmapButton didn't
work.. i got some error message saying
that its an unsupported attempt or something..


Answer 2 is unacceptable.. i already know that..  But please do explain on Answer 1,

Thanks.
0
 
LVL 10

Accepted Solution

by:
RONSLOW earned 100 total points
ID: 2803304
Derive a class from CDialogBar.
Either use DDX_Control or explicitly subclass the bitmap button in the OnInitDialog.

If this is what you already tried, please give a more specific error message so we can see what went wrong.
0
 
LVL 30

Expert Comment

by:Axter
ID: 2804417
lamer,
Can you post your class code.  Just the class that is creating the CDialogBar.
0
 

Author Comment

by:lamer
ID: 2839947
its ok, ive got the codes from Code guru and ive fixed the bug.

Basically what i did was extended the A CdialogBar class to CDialogBarEx

and later extended CDialogBarEx to another class. THis is to facillitate the OnInitDialog for a CDialogBar.

0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

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: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Suggested Courses

617 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