Solved

CbitmapButton on CDialogBar

Posted on 2000-04-01
8
596 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
  • 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
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!

 
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Separate files macro - Errors on larger data set 18 73
fizzArray2 challenge 1 101
Path of Workbook 3 86
JQuery serialize and unserialize 8 184
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 (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

685 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