Solved

Writing to an edit box?

Posted on 1998-06-05
8
170 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
  • 3
  • 3
  • 2
8 Comments
 
LVL 3

Accepted Solution

by:
tma050898 earned 50 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
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 

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

ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
bobThere java chalenge 45 92
sum13 challenge 24 107
Excel file not created as expected 7 72
Bartender label printing - switch on and off graphics 3 40
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.

823 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