Re: How toUpdateData() for a single edit box, not the entire dialog??
- From: "Computer" <chollan2@xxxxxxxxxx>
- Date: Fri, 28 Oct 2005 18:23:07 -0700
Hey fish (flounder),
My hard drive crashed, I lost all my stuff. Lost job, Lost freinds, been
depressed, been drinking, I still am.
I lost your link, and could not remember your name, except that it was a
fish and had something to do with a fish and avoiding GetDlgItem().
Well, I just wanted to say Hi. Appreciate all the help. No repsonse is
required or needed.
Regards,
"Joseph M. Newcomer" <newcomer@xxxxxxxxxxxx> wrote in message
news:c2i5m15un519nik27ds7cb06r2l3f9hlhs@xxxxxxxxxx
> My belief is that UpdateData should never be called. So I *only*
> manipulate controls
> independently. SetWindowText and GetWindowText work fine, without the
> problems of
> UpdateData. Key here is that you should eliminate all instances of
> GetDlgItem and all
> instances of UpdateData from your code. Note that UpdateData is not a
> member of CEdit, so
> would have no effect. I'm surprised that code like this would even
> compile.
>
> See my essays on avoiding GetDlgItem and avoiding UpdateData on my MVP
> Tips site.
>
> As to why the second one works, it is because it is manipulating the
> window. Again, using
> GetDlgItem is an exceptionally poor approach here. On the other hand. in
> the first
> example, at no time did you ever do anything to change the contents of the
> window.
> joe
>
> On Fri, 28 Oct 2005 13:59:09 -0700, "Thor" <junkforme@xxxxxxx> wrote:
>
>> Using VC++ 6 I have created an MFC exe Dialog project. On the Dialog are
>>many CEdit edit boxes. I have no problem updating data for the entire
>>dialog,
>>but I want to updata for only certain edit boxes at certain times. The
>>following code seems like it should work, but it doesn't; it just has no
>>effect.
>>
>> CEdit* myPoint;
>> myPoint=(CEdit*)GetDlgItem(IDC_EDIT2);
>> myPoint->UpdateData();
>>
>>It doesn't matter if it is UpdateData(TRUE) or UpdateData(FALSE).
>>
>>Similar code to show or hide CStatic texts works just fine.
>> CStatic* myPoint;
>> myPoint=(CStatic*)GetDlgItem(IDC_STATIC_0);
>> myPoint->ShowWindow(SW_HIDE);
> Joseph M. Newcomer [MVP]
> email: newcomer@xxxxxxxxxxxx
> Web: http://www.flounder.com
> MVP Tips: http://www.flounder.com/mvp_tips.htm
.
- Prev by Date: Re: MFC Migration/Integration
- Next by Date: Re: Advice needed binary configuration files
- Previous by thread: Re: How toUpdateData() for a single edit box, not the entire dialog??
- Next by thread: how to set list control scroll bar position?
- Index(es):
Relevant Pages
|
Loading