Click to See Complete Forum and Search --> : VC++ Beginner


Charlie Curtis
April 16th, 1999, 01:26 PM
Could someone please explain more about owner drawn items. I have a dialog app that uses two edit boxes for the user to enter a starting/ending date. When the user presses the Create files button I am creating files from ODBC calls to an Oracle Database. I would like to add a owner drawn button with a butmap attached. My problem is that I see a lot of code on the subject, but am having a hard time implementing as I don't understand what needs to go where in my current source code! Some (for lack of a better word IDIOT) assistance would be Greatly Appreciated. I just want to add the button and hhave the bitmap drawn on it at that point I think I can get the rest! Thank you for your patience in advance! Charlie

Shaun McCullough
April 16th, 1999, 02:24 PM
About the button, I don't know. I'm also kinda new to Visual C++ and I could take a guess, but that can be risky.

I have, however, done some Oracle Database programming with Visual C++. Are you familiar with Oracle OLE3.2 objects? Basically, they encapsulate and wrap the ODBC driver calls with some really nifty classes. We have had no problems with them and they work really really good.

You might really want to take a look at them and use them instead of ODBC drivers, if possible.

Good Luck
Shaun

Charlie Curtis
April 16th, 1999, 05:28 PM
Hello Shaun,

Haven't used OLE3.2 as yet. However, I will give it a look see since you have indicated that it is so nice! Thanks for the Info!

Charlie

Daniel Levine
April 16th, 1999, 09:38 PM
Hi,

Here is EXACTLY what to do to implement an owner-draw button.

1. In the dialog resource, create a button. Check the Owner Draw property. Give it a caption (yes, it does matter what the name is.) For this example, we'll make the button's caption MYBUTTON. The button ID is IDC_MYBUTTON.

2. Create 4 bitmap resources, all the same size, whose ID's are: "MYBUTTON-", where the - is U for the up state, D for the down state, X for the disabled state, and F for the focused state. Only the up (U) state is necessary. The quotation marks are a necessity.

3. In your dialog class's header file, declare a CBitmapButton object (eg. CBitmapButton m_btnMyButton).

4. In your dialog classes's OnInitDialog() function (over-ride the default if you haven't already), add the line: m_btnMyButton.AutoLoad(IDC_MYBUTTON,this);

5. Use Classwizard to handle the BN_CLICKED message.

That's about it. I hope that helps.

Daniel.

Charlie Curtis
April 17th, 1999, 07:59 AM
Daniel,

Thanks! That is exactly what I needed! Appreciated the detailed info!

Charlie

Charlie Curtis
January 6th, 2000, 02:56 PM
DONE

January 6th, 2000, 03:06 PM
Could you please post your code so that we can share.
Appreciate in advance.