Click to See Complete Forum and Search --> : component control for modeless dialog


October 24th, 1999, 04:14 AM
hi all..
in my dialog based project I am using a modeless dialog and there is a label box in that dialog..From my main dialog, I am trying to pass a string to that label box after pushing the button ..But I can see nothing in the label box...Simply, my source code is:

CMainDlg::OnButton1()
{
CModeless *p;
p->m_display="sample"; //m_display=member variable for label box
UpdateData(FALSE);

but I see nothing in the label box which is located in the modeless box..

I am looking forward to your suggestions...
Thanks in advance---

mdangers
October 24th, 1999, 06:40 AM
Hi !

a couple of comments concerning your code-fragment

1. the pointer to your CModeless does not point anywhere.
you are neither allocating memory for the object nor
are you pointing it to an existing CModeless-object.

2. If you want to update the dialogdata after changing the
content of a membervariable associated with a control
you need to call the UpdateData-Method of your
CModeless, not of your CMainDlg

Regards,

Matthias.

October 24th, 1999, 02:02 PM
then can u offer me a correct code fragment, using the names I declared in my previous question, friend?

I would be very pleased of that...
Regards....

mdangers
October 24th, 1999, 02:10 PM
Hi !

here we go:
// initialize p with a pointer to your CModeless
// I don't know where you create it so I can't tell you how
// to obtain the pointer at this point

CModeless *p;

// OK
p->m_display="sample";

// Changed
p->UpdateData(FALSE);

regards,

Matthias.

I had a thought,
You know, I thought it a lot,
I thought I was smart,
Now I know that I'm not

- The Presidents Of The United States Of America