Click here to Skip to main content
15,897,518 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionSerial Communication with a Garmin Device Pin
dinesh_pam19-Jul-06 8:40
dinesh_pam19-Jul-06 8:40 
QuestionRe: Serial Communication with a Garmin Device Pin
cppcook19-Jul-06 9:02
cppcook19-Jul-06 9:02 
AnswerRe: Serial Communication with a Garmin Device Pin
kitty519-Jul-06 9:11
kitty519-Jul-06 9:11 
GeneralRe: Serial Communication with a Garmin Device Pin
dinesh_pam19-Jul-06 9:29
dinesh_pam19-Jul-06 9:29 
GeneralRe: Serial Communication with a Garmin Device Pin
kitty519-Jul-06 9:45
kitty519-Jul-06 9:45 
GeneralRe: Serial Communication with a Garmin Device Pin
dinesh_pam19-Jul-06 10:06
dinesh_pam19-Jul-06 10:06 
AnswerRe: Serial Communication with a Garmin Device Pin
led mike19-Jul-06 10:33
led mike19-Jul-06 10:33 
QuestionDialog Box DDX problem Pin
kitty519-Jul-06 8:13
kitty519-Jul-06 8:13 
Background:
I first created an MDI MFC application called test.

I then created a dialog named: IDD_MANUAL_CDIN.
This does simple data exchange:
User inputs a string in edit box1 (i.e. hello).
User clicks on "SEND" button.
User should see in edit box2 "I typed: hello".

I then created a class for that dialog which is implemented in manual.cpp:
<br />
#include "stdafx.h"<br />
#include "test.h"<br />
#include "manual.h"<br />
<br />
// manual dialog<br />
IMPLEMENT_DYNAMIC(manual, CDialog)<br />
<br />
manual::manual(CWnd* pParent /*=NULL*/)<br />
	: CDialog(manual::IDD, pParent)<br />
	, m_nIn(_T("init"))<br />
	, m_nSent(_T("I sent "))<br />
{}<br />
<br />
void manual::DoDataExchange(CDataExchange* pDX)<br />
{<br />
	CDialog::DoDataExchange(pDX);<br />
	DDX_Text(pDX, IDC_IN, m_nIn);<br />
	DDX_Text(pDX, IDC_SENT, m_nSent);<br />
}<br />
<br />
BEGIN_MESSAGE_MAP(manual, CDialog)<br />
	ON_BN_CLICKED(IDC_BUTTON_SEND, &manual::OnButtonSend)<br />
END_MESSAGE_MAP()<br />
<br />
// App command to run the dialog<br />
void manual::OnManual()<br />
{<br />
	manual manualDlg;<br />
	manualDlg.DoModal();<br />
}<br />
// manual message handlers<br />
<br />
void manual::OnButtonSend()<br />
{<br />
	// TODO: Add your control notification handler code here<br />
	AfxMessageBox(tempSend); //DEBUG<br />
	AfxMessageBox(m_nIn); //DEBUG<br />
	m_nSent += m_nIn;<br />
}<br />

and manual.h:
<br />
class manual : public CDialog<br />
{<br />
	DECLARE_DYNAMIC(manual)<br />
<br />
public:<br />
	manual(CWnd* pParent = NULL);   // standard constructor<br />
	virtual ~manual();<br />
	afx_msg void OnManual();<br />
<br />
// Dialog Data<br />
	enum { IDD = IDD_MANUAL_CDIN };<br />
<br />
protected:<br />
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support<br />
<br />
	DECLARE_MESSAGE_MAP()<br />
public:<br />
	CString m_nIn;<br />
	CString m_nSent;<br />
	afx_msg void OnButtonSend();<br />
};<br />

I then changed the toolbar created by the MFC App wizard so that when you click one button it will open a dialog that corresponds to that button.
All this code is in the test.cpp file:
I do:
<br />
#include "manual.h"<br />
BEGIN_MESSAGE_MAP(CSpaceCubeDataRxApp, CWinApp)<br />
	ON_COMMAND(ID_MCD_INPUT, &manual::OnManual)<br />
	ON_COMMAND(ID_APP_ABOUT, &CtestApp::OnAppAbout)<br />
	// Standard file based document commands<br />
	ON_COMMAND(ID_FILE_NEW, &CWinApp::OnFileNew)<br />
	ON_COMMAND(ID_FILE_OPEN, &CWinApp::OnFileOpen)<br />
END_MESSAGE_MAP()<br />

Question:
After compiling I go to type in the string "hello" and click send and nothing pops up in edit box2. I know the "SEND" button function works b/c of the DEBUG AfxMessageBox the I put in it. Nothing is assigned to the variable m_nIn. The data exchange isn't working.

What am I missing?

Kitty5
AnswerRe: Dialog Box DDX problem Pin
Michael Dunn19-Jul-06 8:30
sitebuilderMichael Dunn19-Jul-06 8:30 
GeneralRe: Dialog Box DDX problem Pin
kitty519-Jul-06 8:32
kitty519-Jul-06 8:32 
QuestionRe: Dialog Box DDX problem [modified] Pin
kitty521-Jul-06 3:10
kitty521-Jul-06 3:10 
QuestionRe: Dialog Box DDX problem Pin
David Crow19-Jul-06 9:29
David Crow19-Jul-06 9:29 
AnswerRe: Dialog Box DDX problem Pin
kitty520-Jul-06 3:47
kitty520-Jul-06 3:47 
GeneralRe: Dialog Box DDX problem Pin
David Crow20-Jul-06 4:22
David Crow20-Jul-06 4:22 
QuestionProblem with the pow( ) function [modified] Pin
KaKa'19-Jul-06 7:29
KaKa'19-Jul-06 7:29 
QuestionRe: Problem with the pow( ) function Pin
David Crow19-Jul-06 7:34
David Crow19-Jul-06 7:34 
AnswerRe: Problem with the pow( ) function Pin
toxcct19-Jul-06 7:35
toxcct19-Jul-06 7:35 
QuestionRe: Problem with the pow( ) function Pin
pgav19-Jul-06 7:37
pgav19-Jul-06 7:37 
AnswerRe: Problem with the pow( ) function Pin
cppcook19-Jul-06 7:42
cppcook19-Jul-06 7:42 
GeneralRe: Problem with the pow( ) function Pin
Zac Howland19-Jul-06 8:41
Zac Howland19-Jul-06 8:41 
AnswerAmbiguous call Pin
Ennis Ray Lynch, Jr.19-Jul-06 8:47
Ennis Ray Lynch, Jr.19-Jul-06 8:47 
AnswerRe: Problem with the pow( ) function Pin
NrmMyth19-Jul-06 12:20
NrmMyth19-Jul-06 12:20 
GeneralRe: Problem with the pow( ) function Pin
KaKa'26-Jul-06 22:21
KaKa'26-Jul-06 22:21 
QuestionEdit Box alignment problem Pin
cppcook19-Jul-06 7:24
cppcook19-Jul-06 7:24 
QuestionRe: Edit Box alignment problem Pin
David Crow19-Jul-06 7:32
David Crow19-Jul-06 7:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.