From 753c0c704b3581fa6cfbaf7412efd1f0ced6e8c2 Mon Sep 17 00:00:00 2001 From: fcolin Date: Thu, 1 Feb 2007 13:10:41 +0000 Subject: Utilisateur : Fcolin Date : 14/03/00 Heure : 14:49 Archivé dans $/Bus/Test Commentaire: modif Text Scroll (vss 8) --- Bus/IvyProbe/IvyProbeDlg.cpp | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/Bus/IvyProbe/IvyProbeDlg.cpp b/Bus/IvyProbe/IvyProbeDlg.cpp index ff339c1..62fd7ac 100644 --- a/Bus/IvyProbe/IvyProbeDlg.cpp +++ b/Bus/IvyProbe/IvyProbeDlg.cpp @@ -80,7 +80,6 @@ void CTestDlg::DoDataExchange(CDataExchange* pDX) //{{AFX_DATA_MAP(CTestDlg) DDX_Control(pDX, IDC_REGEXP, m_expr); DDX_Control(pDX, IDC_MSG, m_msg); - DDX_Control(pDX, IDC_TEXT, m_text); DDX_Control(pDX, IDC_SLIDER7, m_slider7); DDX_Control(pDX, IDC_SLIDER6, m_slider6); DDX_Control(pDX, IDC_SLIDER5, m_slider5); @@ -165,7 +164,9 @@ BOOL CTestDlg::OnInitDialog() ); UpdateLayout (); - // TODO: Add extra initialization here + // extra initialization here + m_text.SubclassDlgItem (IDC_TEXT, this); + m_slider0.SetRange( 0, 127); m_slider1.SetRange( 0, 127); m_slider2.SetRange( 0, 127); @@ -235,12 +236,10 @@ void CTestDlg::IvyCallback(IvyApplication *app, int argc, const char **argv) int i; CString text; TRACE(" Called function args:"); - text.Format("Ivy callback %d args\r\n",argc ); - WriteMessage( text ); + WriteMessage( "Ivy callback %d args",argc ); for ( i = 0; i < argc; i++ ) { - text.Format("Ivy callback arg%d '%s'\r\n",i, argv[i] ); - WriteMessage( text ); + WriteMessage( " arg%d='%s'",i, argv[i] ); TRACE(" '%s'",argv[i]); } TRACE("\n"); @@ -296,20 +295,21 @@ TRACE("Direct Msg Receive %d, %s\n",id,arg ); void CTestDlg::OnApplicationConnected(IvyApplication *app) { - CString text; - text.Format("Application: %s ready\r\n",(LPCSTR)(app->GetName()) ); - WriteMessage( text ); + WriteMessage( "Application: %s ready",(LPCSTR)(app->GetName()) ); } void CTestDlg::OnApplicationDisconnected(IvyApplication *app) { - CString text; - text.Format("Application: %s bye\r\n",(LPCSTR)(app->GetName()) ); - WriteMessage( text ); + WriteMessage( "Application: %s bye",(LPCSTR)(app->GetName()) ); } -void CTestDlg::WriteMessage(const CString & text) +void CTestDlg::WriteMessage(LPCTSTR format, ...) { - m_text.SetSel( -1, -1, FALSE ); - m_text.ReplaceSel( text ); + CString str; + // format and write the data we were given + va_list args; + va_start(args, format); + str.FormatV(format, args); + + m_text.AppendString( str ); } @@ -334,9 +334,7 @@ void CTestDlg::OnSend() { m_msg.AddString( buffer ); } - CString mess; - mess.Format("Sending %d message %s\r\n",count,buffer); - WriteMessage( mess ); + WriteMessage( "Sending %d message %s",count,(LPCSTR)buffer ); m_msg.Clear(); } @@ -351,8 +349,6 @@ void CTestDlg::OnBind() { m_expr.AddString( buffer ); } - CString mess; - mess.Format("Binding to %s\r\n",buffer); - WriteMessage( mess ); + WriteMessage( "Binding to %s", (LPCSTR)buffer ); m_expr.Clear(); } -- cgit v1.1