Re: DoDataExchange, GetDlgItem and Controls
- From: Joseph M. Newcomer <newcomer@xxxxxxxxxxxx>
- Date: Thu, 31 Jul 2008 23:37:34 -0400
I disapprove of explicitly writing an UpdateData call in the code. Since the implicit one
done during CDialog::OnInitDialog and CDialog::OnOK are not explicitly coded, I feel free
to tolerate them, as long as all I'm handling are simple edit controls and check boxes.
Nothing else.
joe
On Thu, 31 Jul 2008 12:32:04 -0400, David Wilkinson <no-reply@xxxxxxxxxxxx> wrote:
Joseph M. Newcomer wrote:Joseph M. Newcomer [MVP]
I strongly believe that DD* for data is pointless. It does the validation at the wrong
time, in the wrong way, and produces inappropriate error messages. Validation is not a
big deal to do right, and I've been doing it without DDV_ style validation for 13 years
now without feeling that I'm being burdened with anything. In some cases the validation
is very complex, involving constraint equations. I would not trust something like this to
a mechanism that is trying to be all things to all programmers.
In addition, I have no particular problem with the idea of setting string variables for
dialogs I'm launching; I use the one-and-only implicit call to UpdateData to preload the
trivial controls, and for OnOK use the one-and-only impicit call to UpdateData to capture
the controls. But I would never use it within a dialog. GetWindowText works wonders for
retrieving edit controls; SetWindowText for setting them. The problem is that the
mechanisms just don't scale well to other kinds of controls, and presume silly and
unbelievable things like you know the index of a value in a combo box (which never happens
in real life).
Joe:
You know, I did not realize that you had tolerance for setting/getting control
data using these "implicit" UpdateData() calls contained in the CDialog base
class. I thought that you disapproved of all such calls, and only tolerated the
initial UpdateData(FALSE) because it does the subclassing of the controls.
In this case I am more inclined to agree with you. Although I do it on occasion,
using UbdateData(TRUE) for intermediate validation is a rather blunt instrument.
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.
- Prev by Date: Re: icon background is not transparent when aero is enabled in vista
- Next by Date: Re: Run-Time Check Failure #2
- Previous by thread: Re: CreateProcess command line
- Next by thread: Re: CRichEditView doublt
- Index(es):
Relevant Pages
|
Loading