?
Solved

Writing to an edit box?

Posted on 1998-06-05
8
Medium Priority
?
178 Views
Last Modified: 2013-11-19
I have a simple dialog app and have a browse button and I want the path of the FileDialog to be written into the edit box.  I have the path stored in a variable already but how do I associate the variable with the edit box.  Then after it is associated with the edit box, does it automatically write the value in when the variable is assigned?

thanks,
j. karau
0
Comment
Question by:karau
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
8 Comments
 
LVL 3

Accepted Solution

by:
tma050898 earned 200 total points
ID: 1316069
Answer coming...
0
 
LVL 3

Expert Comment

by:tma050898
ID: 1316070
To create a DDX "value" member variable associated with a control...

1. From ClassWizard, select the Member Variables tab
2. Using the Add Variable button, create a variable associated with the desired control
3. When you want to update the control's value (e.g., an edit control's text), assign a value to this member variable and call UpdateData(FALSE)

Tom

0
 

Author Comment

by:karau
ID: 1316071
I am sorry I should have mentioned that I am currently working in BC++ so I don't have class wizard.  I do have a DoDataExchange Function already written though, it looks like this:

void COptClass::DoDataExchange(CDataExchange* pDX) {
      CDialog::DoDataExchange(pDX);
        DDX_Text(pDX, IDC_SOUNDEDIT, m_TFile);
}

I think this is correct, where m_TFile is the name of a variable within my COptClass.  If I then call UpdateData(FALSE) after the FileDialog will this work?
0
Get MongoDB database support online, now!

At Percona’s web store you can order your MongoDB database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card. Handle your MongoDB database support now!

 

Expert Comment

by:wyhjin
ID: 1316072
Hi, Man: We are dealing with MFC which stands for MICROSOFT Foundation Class, Not Borland.
0
 

Author Comment

by:karau
ID: 1316073
Borland supports MFC that is why I asked the question.  I just can't afford to purchase Visual C++ so I make do, and BC++ works GREAT, THANK YOU

j.karau
0
 
LVL 3

Expert Comment

by:tma050898
ID: 1316074
karau,

You've probably already figured this out since you graded the question. However, just to make sure that you understand a couple of things...

Yes, UpdateData will work from your Borland app because it is an MFC function. Actually, it is a member function of the CDialog class. Calling UpdateData(FALSE) will update the controls with the values of your DDX member variables. Calling UpdateData(TRUE) will update the DDX member variables with the values from the controls.

Since you are using Borland, the only difference (and once again it looks like you already know this) is that when using DDX, you have to manually code the DoDataExchange calls.

Lemme know if you need any more assistance.

Tom

0
 

Expert Comment

by:wyhjin
ID: 1316075
Following is how I deal with this kind of problem.
1. Get the CEdit pointer by calling GetDlgItem() function.
2. Build up an object of CString, which contains any information    I want to display in CEdit control.
3. Call SetWindowText(Name_of_the-CString) function of CWnd to    display the text embedded in the CString object.
4. check online help for detail of SetWindowText() function.

Any comments and suggestions are welcome.
wyhjin
0
 

Author Comment

by:karau
ID: 1316076
This has been even more helpful than I had imagined, Thank you both tma and wyhjin.

j. karau
0

Featured Post

Get MySQL database support online, now!

At Percona’s web store you can order your MySQL database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question