PDA

Click to See Complete Forum and Search --> : Set button enabled or disabled


morphman2000
Apr 24th, 2001, 04:31 AM
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

Vlatko
Apr 24th, 2001, 12:29 PM
In the class wizard assign a variable with the button.
Ex. m_button

m_button.Enabled(TRUE);

morphman2000
Apr 24th, 2001, 12:53 PM
tnx..

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


'Enabled' : is not a member of 'CButton'


And in the dropdown list of arguments, enabled isn't there....
:(

tnx :)

Vlatko
Apr 24th, 2001, 03:21 PM
Sorry:

m_button.EnableWindow (TRUE);
//and
m_button.SetWindowText ("text");

morphman2000
Apr 24th, 2001, 03:33 PM
tnx :)

That cleared some things up!