Solved

How to preload dialog fields

Posted on 2010-09-15
3
429 Views
Last Modified: 2013-12-14
Hi,

I am writing an mfc based visual c++ application (Visual Studio 2008) and I am having some
difficulties with configuring a modal dialog box.

The dialog box is intended to configure database access parameters - database name,
password etc.

Problem is that I can't figure out how to preload the fields on dialog box creation
ie I need to read some data from the registry, and populate the fields.

Any suggestion for this would be appreciated.  I've tried a number of methods including overloading OnInitialUpdate, but no success.

Thanks

Chris

0
Comment
Question by:chrisd-r
[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
  • 2
3 Comments
 
LVL 31

Accepted Solution

by:
Zoppo earned 500 total points
ID: 33680549
Hi chrisd-r,

best place to do this is in an overloaded 'OnInitDialog' (which you can easy add via ClassWizard by adding a message handler for WM_INIT_DIALOG message) somehow like this:

> BOOL CMyDlg::OnInitDialog()
> {
>  CDialog::OnInitDialog();
>  // load your values here and fill the controls
>  UpdateData( FALSE ); // This is needed if you use DDX-Data exchange using variables for controls
> }

Hope that helps,

ZOPPO
0
 
LVL 31

Expert Comment

by:Zoppo
ID: 33680562
Here you can find samples for some different ways to init the values of an edit control: http://functionx.com/visualc/controls/editbox.htm
0
 

Author Comment

by:chrisd-r
ID: 33680641
Thanks for the help - It is now fixed.

Forgot to call UpdateData(FALSE);

Chris
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article surveys and compares options for encoding and decoding base64 data.  It includes source code in C++ as well as examples of how to use standard Windows API functions for these tasks. We'll look at the algorithms — how encoding and decodi…
As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

717 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