Re: Dialog Class "A" Accessing Data In Derived Dialog Class "B", "C", & "D"
I understand the unique ID concept fine. This is what I have in my personal
message header
.................... code ..................
static const UINT UWM_TABCHANGED = ::RegisterWindowMessage(
_T("UWM_TABCHANGED-{9B8D4AEA_2D5C_11D3_BFA1_00105ACCB218}") );
.................... code ..................
This works fine, however, if this is all in one header....
.................... code ..................
#define UWM_TABCHANGED
_T("UWM_TABCHANGED-{9B8D4AEA_2D5C_11D3_BFA1_00105ACCB218}")
#define DECLARE_USER_MESSAGE(name) \
static const UINT name = ::RegisterWindowMessage(name##_MSG);
DECLARE_USER_MESSAGE(UWM_TABCHANGED)
.................... code ..................
Gives several errors:
Invalid wide characters //on the DECLARE...
Obviously I don't have an understanding on how the macros are suppose to
work. sorry about the nuisance in this matter. My idea was to come back to
this at a later time and get a better understanding.
"Joseph M. Newcomer" <newcomer@flounder.com> wrote in message
news:ckna765r1ibdesobmpjh1svtkto6hh7apn@4ax.com...
See below...
On Tue, 24 Aug 2010 16:24:34 -0500, "JCO" <someone@somewhere.com> wrote:
Thanks Joseph and Scott for your help. I now have a better understanding
on
how to do this.
Joseph,
I read your essay on Message Management. I understood most until I got to
your Macro you use to simplify the hassles of messages (little confusing).
In my case, I'm not using an ID with a Unique Number created by the GUID
generator. I will have to review that a bit more.
****
The idea of using a GUID is to create a name that cannot possibly ever,
under any
imaginable circumstances, conflict with anyone else's name, ever.
The macro is pretty straightforward, so let me know what you found
confusing and I can try
to explain it.
joe
****
"Joseph M. Newcomer" <newcomer@flounder.com> wrote in message
news:6npj66lotfkb5jf2uld25ar1qbh8ttdhou@4ax.com...
See my previous technique of having a parameter structure that is used
for
communication.
joe
On Mon, 16 Aug 2010 12:30:10 -0500, "JCO" <someone@somewhere.com> wrote:
I guess that is my issue. The button "Run" is on the main dialog, not
the
child. I guess within that action, I can get a pointer to Tab Control
Page
do the checks that way. I'm not sure I like that method for this
reason.
The Tabs (1-3) are type child but since they are also individual Classes
(derived from CDialog) it seems that each actual Tab should do its own
processing of data and only send the final results to the main dialog.
Not
sure that is the proper logic .. .which is why I questioned it.
"ScottMcP [MVP]" <scottmcp@mvps.org> wrote in message
news:512da83d-564a-43c3-86ab-1eebbcb2d413@u26g2000yqu.googlegroups.com...
On Aug 16, 9:05 am, "JCO" <some...@somewhere.com> wrote:
What is the best way so that my main dialog knows when all of the
CEdit
Box
on a Tab Control contains valid data and is ready to be process?
The user should be able to click a button (like 'Apply') to start
processing the data. If the button is on a child dialog the button
handler can use SendMessage to inform the main dialog.
What is the best way so that the Main Dialog knows when the Tab
Control
changes Pages? Currently I have a message handler in the
ControlDialog
that
contains the 3-tabs as shown:
void CMyTabCtrl::OnSelchange(NMHDR *pNMHDR, LRESULT *pResult)
This works Fine!
A member variable of CMyTabCtrl is on my main dialog named m_tbCtrl,
therefore, from the main dialog I can get the current tab as shown:
int nSel = m_tbCtrl.GetCurSel(); //zero indx
What I really need is a way so that the main dialog is automatically
aware
that the Tab Control has changed. I suspect it has to do with a
SendMessage() but I'm not sure how that is done.
Thanks
A child can use GetParent() to get a CWnd* to its parent.
In the child.h file define a message to be sent to the parent:
#define MY_CUSTOM_MESSAGE (WM_APP + 3)
When you want to send the message do this:
CWnd* pParent = GetParent();
pParent->SendMessage(MY_CUSTOM_MESSAGE, wparam, lparam);
The parent can receive the message with this in its message map:
ON_MESSAGE(MY_CUSTOM_MESSAGE, OnMyCustomMessage)
...and the message handler must have this signature...
LRESULT CParentDlg::OnMyCustomMessage(WPARAM w, LPARAM p)
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm