Click to See Complete Forum and Search --> : Control Variables


Shahzad
April 9th, 1999, 08:48 AM
I have used the control variables attached in codeguru, when just attached..changes the appearance of the control. I wonder how does this occur with out any code in our program. If you know please reply me where and when the code runs to change the appearance. And what happens if there is no variable attached to a control?

I will appreciate anything you can contribute.

Dave Lorde
April 9th, 1999, 08:58 AM
Please explain what you are talking about, with examples, if possible.

Dave

Shahzad
April 9th, 1999, 10:59 AM
Example of my question is:

Add a Class CFlatComboBox to your project from codeguru (combobox section)
Add a combo box to your dialog, and attach a control vaiable using class wizard.
Rename the CComboBox manually with CFlatComboBox. thats all!

Now run your project and the looks of your control box would have been changed.
My question is how does this happen! just by attaching a variable! How does the code run in the CFlatComboBox, It looks as if we have never called it! yet it is executed.

If you can help, you will solve my mystery!

Gomez Addams
April 9th, 1999, 11:16 AM
What typically happens is that declaring a control in this
manner causes the default control to be subclassed
(which is windoze lingo that means its behavior has been
overridden) and the new class handles all drawing messages
which results in the new appearance. Those messages
not handled by the new class are handled by the base class
which results in the default behavior for a given message.

Dave Lorde
April 9th, 1999, 11:17 AM
When you rename CComboBox to CFlatComboBox you make the CFlatComboBox code replace the CComboBox code that manages the 'raw' Windows combobox control. This code paints it differently.

CComboBox and CFlatComboBox both effectively subclass the underlying combobox control and can mess around with its appearance by handling the paint messages sent to it.

Dave

Masaaki
April 9th, 1999, 11:54 AM
Hi.

Simply saying, base class is manuplated this action.
Developer of Microsoft wrote these base class called MFC.

When we write the VC++ code, especially GUI,
base class includes the whole code.
So, if we change this base class code, you will change the apperance
of GUI.
That is, you also have a chance that you will write your own code
to change base class.
However, ActiveX control seems to be easy and faster.

Regards.
-Masaaki Onishi-