Solved

Dialog Box??

Posted on 1998-12-21
11
256 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
[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
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Creating Labels and Frequency list style reports in SAS code 9 110
Named range not carried over 10 66
How to know only "File created" with EventLog 3 35
either24  challenge 19 105
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: 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.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

740 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