Results 1 to 5 of 5

Thread: Set button enabled or disabled

  1. #1

    Thread Starter
    Addicted Member morphman2000's Avatar
    Join Date
    Oct 2000
    Location
    Europe, The Netherlands
    Posts
    254

    Question

    I'm new to VC++. So please help me out... tnx

    When I begin an MFC-project, dialog-based, I can put functions and code to events. I have played with the messagebox and other things, but what I want to know now, is what do I have to do, to get "Hello world" into a textfield(text1.text = "hello world") or set the caption of a button to it(command1.caption = "hello world") for example.

    Other question, how can I disable and enable a button (commandbutton in VB, 'command1.enabled = false').

    Thanks.

    morph

  2. #2
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    In the class wizard assign a variable with the button.
    Ex. m_button
    Code:
    m_button.Enabled(TRUE);
    I am become death, the destroyer of worlds.
    mail:[email protected]

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

  3. #3

    Thread Starter
    Addicted Member morphman2000's Avatar
    Join Date
    Oct 2000
    Location
    Europe, The Netherlands
    Posts
    254

    Question

    tnx..

    Made the variable... tried the code, but when compiling it gives me this error:

    Code:
    'Enabled' : is not a member of 'CButton'
    And in the dropdown list of arguments, enabled isn't there....


    tnx

  4. #4
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    Sorry:
    Code:
    m_button.EnableWindow (TRUE);	
    //and
    m_button.SetWindowText ("text");
    I am become death, the destroyer of worlds.
    mail:[email protected]

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

  5. #5

    Thread Starter
    Addicted Member morphman2000's Avatar
    Join Date
    Oct 2000
    Location
    Europe, The Netherlands
    Posts
    254

    Thumbs up

    tnx

    That cleared some things up!

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