Solved

Dialog Box??

Posted on 1998-12-21
11
250 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
 
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
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: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

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
GIF file bit manipulation for color change 5 107
Pressing cancel button with C# UI Automation 3 51
abstract class with all non abstract mentods 6 76
Line meaning 9 82
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

920 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

15 Experts available now in Live!

Get 1:1 Help Now