|
-
February 4th, 2004, 09:03 PM
#1
Can UpdateData(true) be called for only 1 var?
To redefine an earlier problem.... I have a GUI with multiple edit boxes and a TreeControl. When the user clicks from the Editbox(s) to the TreeControl I need the updated info from the EditBox but someof the "pre-click" or old data from the TreeControl. Can I call UpdateData(true) on a specific EditBox?
-
February 4th, 2004, 09:12 PM
#2
No, you can not call UpdateData() on individual controls. You could create DataExchange object and call one control's DDX_... method, but that is too much work.
Simply call GetWindowText() for your edit box.
Vlad - MS MVP [2007 - 2012] - www.FeinSoftware.com
Convenience and productivity tools for Microsoft Visual Studio:
FeinWindows - replacement windows manager for Visual Studio, and more...
-
February 4th, 2004, 09:23 PM
#3
Originally posted by VladimirF
No, you can not call UpdateData() on individual controls. You could create DataExchange object and call one control's DDX_... method, but that is too much work.
Simply call GetWindowText() for your edit box.
I would but the editbox is a float and not a string. I just need to grab the data in one editbox before the focus changes and when calling UpdateData(true) in OnKillFocus for the edit box I get stuck getting ALL the data exchanged...
-
February 5th, 2004, 04:00 AM
#4
AFAIK every edit box contains a string. Maybe there is a filter to only allow numerical values to be entered, but everything is a string. Do not confuse your edit box with an attached member-variable, which might be float.
Nomally DDX is doing the conversion for you. Using GetWindowText() should not call the DDX.
Marc
-
February 5th, 2004, 09:14 AM
#5
Originally posted by VladimirF
No, you can not call UpdateData() on individual controls. You could create DataExchange object and call one control's DDX_... method, but that is too much work.
Simply call GetWindowText() for your edit box.
Too much work??? It's 2 lines of code.
CDataExchange DX(TRUE, this);
DDX_Text(&DX, IDC_MY_CONTROL, m_FloatValue);
-
February 5th, 2004, 05:16 PM
#6
Originally posted by GCDEF
Too much work??? It's 2 lines of code.
Everyone has his own threshold for work...
Of course, you are right.
Vlad - MS MVP [2007 - 2012] - www.FeinSoftware.com
Convenience and productivity tools for Microsoft Visual Studio:
FeinWindows - replacement windows manager for Visual Studio, and more...
-
February 5th, 2004, 07:51 PM
#7
Originally posted by VladimirF
Everyone has his own threshold for work...
Threshold? Well, calling DDX_Text actually requires only two lines of code. The equivalent code amount for using GetWindowText() is not below or near that threshold, but goes somewhat like this (even without taking into account the (formerly unknown) fact that the control maps to a float variable):
Code:
CWnd* pEdit = GetDlgItem(IDC_MY_CONTROL);
if(pEdit->GetSafeHwnd())
{
pEdit->GetWindowText(m_myValue);
}
With the float, you have to add another two lines for the CString declaration and the atof() call...
Just kidding and being picky, of course...
-
February 5th, 2004, 08:18 PM
#8
Originally posted by gstercken
Just kidding and being picky, of course...
I was kidding too. I simply misjudged the effort in my first post, probably thinking that it would involve actually creating a custom DDX_... function. I WAS WRONG.
Hey, give me some credit too - I suggested the possibility of using DataExchange object in my first post!
Vlad - MS MVP [2007 - 2012] - www.FeinSoftware.com
Convenience and productivity tools for Microsoft Visual Studio:
FeinWindows - replacement windows manager for Visual Studio, and more...
-
February 5th, 2004, 08:33 PM
#9
Last edited by gstercken; February 5th, 2004 at 08:35 PM.
-
February 5th, 2004, 08:34 PM
#10
Thank you! That all I've asked for...
Vlad - MS MVP [2007 - 2012] - www.FeinSoftware.com
Convenience and productivity tools for Microsoft Visual Studio:
FeinWindows - replacement windows manager for Visual Studio, and more...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|