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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Updating Modeless Dialog's Variables

Status
Not open for further replies.

forlorn

Programmer
Dec 12, 2001
28
TR
Hi, i have a modeless dialog in my application. I declared its variables private and i want to access them through Get & Set methods. When i press a button on the dialog i want to get the changed variables ( they hold values of textboxes ). So i use UpdateData(TRUE) in OnButton. But all i get are the initial values of the variables. It used to work fine when the dialog was modal. So do you have any idea about what i'm doing wrong?

thanks in advance.
 
Hi,
Can you show us what your OnButton function looks like?
Steve [ponder]
 
Are you sure you update your variables when editbox content is changed?

P.S.: Pseudo-code

OnEditBox1Change(...)
{
GetEditBox1Content(m_editbox1Var);
}
 
In fact there's nothing important in my OnButton function. It looks like this:

void CTheClass::OnButton()
{
UpdateData( TRUE );

CMainFrame *pMainFr = ( CMainFrame * ) AfxGetMainWnd();
CBitirmeDoc *pDoc = ( CBitirmeDoc * )
pMainFr->GetActiveDocument();

pDoc->m_NumerikAnaliz( m_str1 );

Here m_str is the string selected in a combobox. When i pass it, it's ok. It's updated version is passed. But in
m_NumerikAnaliz function when i try to get the other strings in this dialog( by the way, CBitirmeDoc holds an instance of this dialog) i get the initial versions.

Why doesn't UpdateData(TRUE) work and update all the variables at the same time?
And i didn't create edit controls for the edit boxes, just CString variables. But i guess it's not the cause of the problem. It used to work dialog was modal.

Anyway, thanks for sparing time to read my endless blabberings!!
 
In fact there's nothing important in my OnButton function. It looks like this:

void CTheClass::OnButton()
{
UpdateData( TRUE );

CMainFrame *pMainFr = ( CMainFrame * ) AfxGetMainWnd();
CBitirmeDoc *pDoc = ( CBitirmeDoc * )
pMainFr->GetActiveDocument();

pDoc->m_NumerikAnaliz( m_str1 );

Here m_str is the string selected in a combobox. When i pass it, it's ok. It's updated version is passed. But in
m_NumerikAnaliz function when i try to get the other strings in this dialog( by the way, CBitirmeDoc holds an instance of this dialog) i get the initial versions.

Why doesn't UpdateData(TRUE) work and update all the variables at the same time?
And i didn't create edit controls for the edit boxes, just CString variables. But i guess it's not the cause of the problem. It used to work dialog was modal.

Anyway, thanks for sparing time to read my endless blabberings!! Any help is highly appreciated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top