merged 2.2 branch
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@7748 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -74,11 +74,14 @@ MyClient *my_client ;
|
||||
// main frame
|
||||
bool MyApp::OnInit()
|
||||
{
|
||||
wxString server = "4242";
|
||||
wxString hostName = wxGetHostName();
|
||||
// service name (DDE classes) or port number (TCP/IP based classes)
|
||||
wxString service = "4242";
|
||||
|
||||
// ignored under DDE, host name in TCP/IP based classes
|
||||
wxString hostName = "localhost";
|
||||
|
||||
if (argc > 1)
|
||||
server = argv[1];
|
||||
service = argv[1];
|
||||
if (argc > 2)
|
||||
hostName = argv[2];
|
||||
|
||||
@@ -88,7 +91,7 @@ bool MyApp::OnInit()
|
||||
// suppress the log messages from MakeConnection()
|
||||
{
|
||||
wxLogNull nolog;
|
||||
the_connection = (MyConnection *)my_client->MakeConnection(hostName, server, "IPC TEST");
|
||||
the_connection = (MyConnection *)my_client->MakeConnection(hostName, service, "IPC TEST");
|
||||
|
||||
while ( !the_connection )
|
||||
{
|
||||
@@ -100,7 +103,7 @@ bool MyApp::OnInit()
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
the_connection = (MyConnection *)my_client->MakeConnection(hostName, server, "IPC TEST");
|
||||
the_connection = (MyConnection *)my_client->MakeConnection(hostName, service, "IPC TEST");
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -45,6 +45,7 @@
|
||||
IMPLEMENT_APP(MyApp)
|
||||
|
||||
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||
EVT_MENU (SERVER_EXIT, MyFrame::OnExit)
|
||||
EVT_LISTBOX(SERVER_LISTBOX, MyFrame::OnListBoxClick)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
@@ -72,14 +73,15 @@ bool MyApp::OnInit()
|
||||
// Create the main frame window
|
||||
(new MyFrame(NULL, "Server"))->Show(TRUE);
|
||||
|
||||
// create the server object
|
||||
wxString server_name = "4242";
|
||||
// service name (DDE classes) or port number (TCP/IP based classes)
|
||||
wxString service = "4242";
|
||||
|
||||
if (argc > 1)
|
||||
server_name = argv[1];
|
||||
service = argv[1];
|
||||
|
||||
// Create a new server
|
||||
m_server = new MyServer;
|
||||
m_server->Create(server_name);
|
||||
m_server->Create(service);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -109,7 +111,7 @@ MyFrame::MyFrame(wxFrame *frame, const wxString& title)
|
||||
// Make a menubar
|
||||
wxMenu *file_menu = new wxMenu;
|
||||
|
||||
file_menu->Append(SERVER_QUIT, "&Exit");
|
||||
file_menu->Append(SERVER_EXIT, "&Exit");
|
||||
|
||||
wxMenuBar *menu_bar = new wxMenuBar;
|
||||
|
||||
@@ -132,7 +134,7 @@ MyFrame::MyFrame(wxFrame *frame, const wxString& title)
|
||||
}
|
||||
|
||||
// Set the client process's listbox to this item
|
||||
void MyFrame::OnListBoxClick(wxCommandEvent& event)
|
||||
void MyFrame::OnListBoxClick(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxListBox* listBox = (wxListBox*) panel->FindWindow(SERVER_LISTBOX);
|
||||
if (listBox)
|
||||
@@ -145,6 +147,11 @@ void MyFrame::OnListBoxClick(wxCommandEvent& event)
|
||||
}
|
||||
}
|
||||
|
||||
void MyFrame::OnExit(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
Close(TRUE);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// IPCDialogBox
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@@ -30,6 +30,7 @@ public:
|
||||
MyFrame(wxFrame *frame, const wxString& title);
|
||||
|
||||
void OnListBoxClick(wxCommandEvent& event);
|
||||
void OnExit(wxCommandEvent& event);
|
||||
|
||||
private:
|
||||
wxPanel *panel;
|
||||
@@ -76,6 +77,6 @@ private:
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#define SERVER_QUIT wxID_EXIT
|
||||
#define SERVER_EXIT wxID_EXIT
|
||||
#define SERVER_LISTBOX 500
|
||||
#define SERVER_QUIT_BUTTON 501
|
||||
|
Reference in New Issue
Block a user