Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Dialog Box??

Posted on 1998-12-21
11
Medium Priority
?
262 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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 150 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

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…
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 …
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.
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

916 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