X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b62ca03d6f409732ca63c68a79b7ae81444222e5..c4e2838090992384911a6a6aa44cac985d79a555:/samples/sockets/client.cpp?ds=inline diff --git a/samples/sockets/client.cpp b/samples/sockets/client.cpp index 9ca5518df8..4ba2ae6c0e 100644 --- a/samples/sockets/client.cpp +++ b/samples/sockets/client.cpp @@ -29,7 +29,7 @@ # pragma hdrstop #endif -// for all others, include the necessary headers +// for all others, include the necessary headers #ifndef WX_PRECOMP # include "wx/wx.h" #endif @@ -205,8 +205,10 @@ MyFrame::MyFrame() : wxFrame((wxFrame *)NULL, wxID_ANY, m_menuBar->Append(m_menuProtocols, _("&Protocols")); SetMenuBar(m_menuBar); +#if wxUSE_STATUSBAR // Status bar CreateStatusBar(2); +#endif // wxUSE_STATUSBAR // Make a textctrl for logging m_text = new wxTextCtrl(this, wxID_ANY, @@ -311,7 +313,7 @@ void MyFrame::OnOpenConnection(wxCommandEvent& WXUNUSED(event)) // // update waitmore if needed. // } // bool success = client->IsConnected(); - // + // // And that's all :-) m_text->AppendText(_("\nTrying to connect (timeout = 10 sec) ...\n")); @@ -326,7 +328,7 @@ void MyFrame::OnOpenConnection(wxCommandEvent& WXUNUSED(event)) m_text->AppendText(_("Failed ! Unable to connect\n")); wxMessageBox(_("Can't connect to the specified host"), _("Alert !")); } - + UpdateStatusBar(); } @@ -361,7 +363,7 @@ void MyFrame::OnTest1(wxCommandEvent& WXUNUSED(event)) m_sock->SetFlags(wxSOCKET_WAITALL); buf1 = _("Test string (less than 256 chars!)"); - len = (wxStrlen(buf1) + 1) * sizeof(wxChar); + len = (unsigned char)((wxStrlen(buf1) + 1) * sizeof(wxChar)); buf2 = new wxChar[wxStrlen(buf1) + 1]; m_text->AppendText(_("Sending a test buffer to the server ...")); @@ -441,7 +443,7 @@ void MyFrame::OnTest2(wxCommandEvent& WXUNUSED(event)) m_text->AppendText(_("Comparing the two buffers ...")); if (memcmp(msg1, msg2, len) != 0) { - m_text->AppendText(_("failed!\n")); + m_text->AppendText(_("failed!\n")); m_text->AppendText(_("Test 2 failed !\n")); } else @@ -622,7 +624,9 @@ void MyFrame::UpdateStatusBar() s.Printf(_("%s : %d"), (addr.Hostname()).c_str(), addr.Service()); } +#if wxUSE_STATUSBAR SetStatusText(s, 1); +#endif // wxUSE_STATUSBAR m_menuSocket->Enable(CLIENT_OPEN, !m_sock->IsConnected() && !m_busy); m_menuSocket->Enable(CLIENT_TEST1, m_sock->IsConnected() && !m_busy);