Solved

Dialog Box??

Posted on 1998-12-21
11
253 Views
Last Modified: 2013-11-20
Hi All,

I have the following question in using the dialog box.
First, let me describ the porblem I faced now.

1.) My project needs to open different database which may contain different number of fields.

2.) After opening a database, if I want to edit the record in the database, a dialog box will be popped-up to let me to change the data of the record.

The problem I faced is how can I create a dialog with suitable number of edit boxes in the dialog.
ie. if the database has 5 fields, there will be 5 edit boxes to display the data. or if the database had 7 fields, there will be 7 edit boxes in the dialog.

Could anyone give me advice?
I know I need to create a dialog in runtime, but how can I do this and get data from this created dialog???

Thank you very much!!!
0
Comment
Question by:cplau
11 Comments
 
LVL 1

Expert Comment

by:The_Brain
ID: 1326469
You need to create the five edit boxes.

now, you hold in ctrl+doubleclick on the editbox of your choice.
You will have an option of all the "m_columnnames."  You pick the one that you want the edit box to diplay.  
it should read.  m_pSet->m_(your column name) etc.
then you run it, and there you have it, you should be able to scroll through the records,  you can move around with
m_pSet.move(x), (maybe ->) just check that.

but careful don't exceed the limit, put a validation in.  Hope this all helps.  
are you doing a DAO?
0
 
LVL 1

Expert Comment

by:The_Brain
ID: 1326470
I will trade with you, set it to 10, and give me the answer to:

How can I when I have inserted a dialog into the workspace, call it and so thing to it and return the corresponding values?

can you help me with that?

0
 
LVL 1

Expert Comment

by:The_Brain
ID: 1326471
I will trade with you, set it to 10, and give me the answer to:

How can I when I have inserted a dialog into the workspace, call it and so thing to it and return the corresponding values?

can you help me with that?

0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
LVL 1

Expert Comment

by:The_Brain
ID: 1326472
I will trade with you, set it to 10, and give me the answer to:

How can I when I have inserted a dialog into the workspace, call it and so thing to it and return the corresponding values?

can you help me with that?

0
 
LVL 1

Expert Comment

by:The_Brain
ID: 1326473
ooops
0
 

Author Comment

by:cplau
ID: 1326474
Dear Brian,

I cannot understand your suggested answer.

For the statement : you hold in ctrl+doubleclick on the editbox of your choice.

I cannot understand this statement. When I hold the control button + double click, the program ask me to add memeber variables for the edit box.

Also, I don't have the option m_columnnames.

Further, I want to ask what is the type of the pointer m_pSet. I haven't used this in my program.

Finally, for your question, do you want to add a dialog into your workspace?
And get data from this dialog....
If not, please describ more detail.....

Thanks!!!
0
 

Expert Comment

by:everlast
ID: 1326475
Well, I guess there's a couple of way's you can do this, add a dialog to your project, overide the OnInitDialog and create the edit controls you need. Or you could make your own dialog template in runtime but I've never done that so I can't help you.

and The_Brain: you realy need to work on your english mate.
0
 

Author Comment

by:cplau
ID: 1326476
Dear Brian,

I cannot understand your suggested answer.

For the statement : you hold in ctrl+doubleclick on the editbox of your choice.

I cannot understand this statement. When I hold the control button + double click, the program ask me to add memeber variables for the edit box.

Also, I don't have the option m_columnnames.

Further, I want to ask what is the type of the pointer m_pSet. I haven't used this in my program.

Finally, for your question, do you want to add a dialog into your workspace?
And get data from this dialog....
If not, please describ more detail.....

Thanks!!!
0
 

Author Comment

by:cplau
ID: 1326477
Dear everlast,

In overwriting the OnInitalDialog fucntion. I have uesd the following statements to create two edit boxes.

CEdit *Test;
Test = new CEdit();
Test->Create(WS_VISIBLE|WS_BORDER,CRect(35,35,100,50),this,100);
Test = new CEdit();
Test->Create(WS_VISIBLE|WS_CHILD|WS_BORDER,CRect(35,60,100,75),this,101);

After creating these two dialog boxes, how can I delete this in order to prevent memory leaks occur in my porgram.
I like to point out that using another variable to create another edit box is not suitable to me because there is no upper limit for the no. of edit boxes to create.

eg. CEdit  *Test1;
     Test1=new CEdit();
    Test1->Create(....);

I cannot know how many pointer must be defined first.

Thanks!!!
0
 
LVL 4

Accepted Solution

by:
pagladasu earned 50 total points
ID: 1326478
The recordset type of variable that will be associated with your database table has a member variable called m_nFields that contains the total number of fields. Store this value in some variable(say n)  before opening the dialog box. In the InitDialog code:
CEdit *pEdit=new CEdit[n];
Then call the create for each.
In the destructor of the dialog box code:
delete [] pEdit;
Hope this helps.
Thanks
pagladasu

0
 
LVL 1

Expert Comment

by:The_Brain
ID: 1326479
Oi nutter, man.  My english is perfectly fine, thank you very much :)

I was just pressed for time, sorry about that.  This in turn, I guess also contributes to why my answer was so sloppy.  Sorry again.  

Don't worry mate *,* my english is under control don't you worry.  Please don't have any sleepless nights over it.

(I do agree with you, my english was TERRIBLE in my answer, I am not arguing with that fact :)  
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Adapt this command to show who installed 29 108
firstChar challenge 13 114
Can not remove SSL certificate on iPhone 6 - iOS10.2 12 526
x-bar in Google Sheets 2 50
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…
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
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 video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

813 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

11 Experts available now in Live!

Get 1:1 Help Now