CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    May 1999
    Posts
    388

    Control Variables

    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.


  2. #2
    Join Date
    Apr 1999
    Posts
    383

    Re: Control Variables

    Please explain what you are talking about, with examples, if possible.

    Dave


  3. #3
    Join Date
    May 1999
    Posts
    388

    Re: Control Variables

    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!


  4. #4
    Join Date
    May 1999
    Location
    Oregon, USA
    Posts
    302

    Re: Control Variables

    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.





  5. #5
    Join Date
    Apr 1999
    Posts
    383

    Re: Control Variables

    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


  6. #6
    Join Date
    May 1999
    Location
    Atlanta, GA, USA
    Posts
    443

    Re: Developer is great.

    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-


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured