Solved

Writing to an edit box?

Posted on 1998-06-05
8
165 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
 

Expert Comment

by:wyhjin
ID: 1316072
Hi, Man: We are dealing with MFC which stands for MICROSOFT Foundation Class, Not Borland.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to match SAS datasets by multiple key variables and then rename and create new variables? 2 86
ORA-01403: no data found 43 90
List out all word 7 261
bigDiff challenge 17 84
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
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.

862 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now