Solved

Writing to an edit box?

Posted on 1998-06-05
8
162 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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Error on moodle after upgrade 3 106
twoTwo  challenge 35 86
withoutTen challenge 14 88
Use of condition with 'serial' in ansible 2 36
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…
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

760 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