Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newby: how to initialize dialog elements? 1

Status
Not open for further replies.

mingis

Programmer
Jan 23, 2002
475
LT
At least I have started my first non-console MFC application :) The first problem I have stroked against - how to initialize dynamically controls of the dialog window.
Under MSVC 6.0 I have created a message box resource IDD_MSGBOX with static text control IDC_STATIC on it. Following found examples the initialization of that control could be like following:

BOOL C_my_msg_box::OnInitDialog()
{
CDialog::OnInitDialog();

m_strTitle="Hello, world";

return TRUE;
}

But I don't see a way to connect an element of dialog class C_my_msg_box::m_strTitle to real data displayed on the control.
Thank you.
 
I tryed out a SetDlgItemText() but it seems to work with input fields but not with the static text fields. The question is still open.

 
hi,
u should add a variable to your control.
suppose u want to display ur variable in a text box. create a text control on your dialog.open class wizard and add a variable of type cedit to this edit control.

after that you add a button control.
double click on that button
you will be opened with a default function.. edit that function with this code
:
(your variable)->setwindowtext("hai");
thats it
when u click the button
your text control will have the hai text inside it.
ok bye
venki
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top