Solved

Dialog Box??

Posted on 1998-12-21
11
248 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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 

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

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.

Join & Write a Comment

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: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

744 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

9 Experts available now in Live!

Get 1:1 Help Now