the class of loginwindow is like this (header file ):
#ifndef __LOGINWIN_H__
#define __LOGINWIN_H__
/**
*@file LoginWindow?


*
*



???LoginWindow??
*
*@author qcli
*/
#include \"paws/pawswidget.h\"
#include \"messagesubscriber.h\"
#include \"paws/pawstextbox.h\"
#include \"paws/pawsbutton.h\"
#include \"message.h\"
#include \"svraccountmessage.h\"
#include \"SPEngine.h\"
#include \"selectwin.h\"
/**
*@brief LoginWindow?

??¼?

*
*



?¼?











?
*








??
*/
class LoginWindow:public pawsWidget, public MessageSubscriber
{
public:
LoginWindow(PawsManager* manager);
~LoginWindow();
bool PostSetup();
/**
*@brief Called whenever a button is pressed.
*@param button The button pressed.
*@param keyModifier Modifier key in effect.
*@param widget The widget the button belongs to.
*@return bool Parent\'s result or FALSE if no parent.
*/
bool OnButtonPressed(int mouseButton,int keyModifier,pawsWidget* widget);
bool OnMouseDown( int button, int modifiers, int x, int y );
/**
*@brief






*@param message





?LOGIN_ACK(??¼???)
*/
void HandleMessage(Message* message);
void SetEngine(SPEngine* engine);
SelectWindow *GetSelect(){return select;}
private:
/**
*@brief






??
*/
void ConnectToServer();
///??¼??š?
pawsEditTextBox* login;
///??¼?

pawsEditTextBox* password;
SelectWindow* select;
SPEngine* loginengine;
pawsButton* okbtn;
pawsButton* cancelbtn;
};
CREATE_PAWS_FACTORY(LoginWindow);
#endif
the .cpp file is like this:
#include
#include
#include
#include
#include \"log.h\"
#include \"loginwin.h\"
#include \"clientnetmanager.h\"
#include \"clientaccountmessage.h\"
#include \"winmanager.h\"
#include \"paws/pawsmanager.h\"
#include \"string.h\"
#define LOGIN_WINDOW_QUIT 100
#define LOGIN_WINDOW_LOGIN 101
LoginWindow::LoginWindow(PawsManager* manager)
:pawsWidget(manager)
{}
LoginWindow::~LoginWindow()
{}
bool LoginWindow::PostSetup()
{
/*
login = (pawsEditTextBox*)FindWidget(\"account\");
if (login == NULL)
return false;
password = (pawsEditTextBox*)FindWidget(\"password\");
if (password == NULL)
return false;
password->SetPassword(true);*/
okbtn = (pawsButton*)FindWidget(\"ok\");
//cancelbtn = (pawsButton*)FindWidget(\"cancel\");
//login->SetParent(this);
//password->SetParent(this);
okbtn->SetParent(this);
//cancelbtn->SetParent(this);
return true;
}
void LoginWindow::SetEngine(SPEngine* engine)
{
loginengine=engine;
return;
}
bool LoginWindow::OnMouseDown( int button, int modifiers, int x, int y )
{
printf(\"login window mouse down!!!!!!!!!!!!!!!!!!!!!\\n\");
//pawsWidget::OnMouseDown( button, modifiers, x, y );
BringToTop((pawsEditTextBox*)this->FindWidget(\"account\"));
BringToTop((pawsEditTextBox*)this->FindWidget(\"password\"));
BringToTop((pawsButton*)this->FindWidget(\"ok\"));
//BringToTop((pawsButton*)this->FindWidget(\"cancel\"));
// WinManager* win = loginengine->GetWinManager();
// win->ShowOKWindow( \"û?
?û?
??\" );
return true;
}
bool LoginWindow::OnButtonPressed( int button, int keyModifier, pawsWidget* widget )
{
printf(\"login window button pressed******************************************\\n\");
switch( widget->GetID() )
{
case LOGIN_WINDOW_QUIT:
{
printf(\"********quit*********\");
loginengine->QuitClient();
return true;
}
case LOGIN_WINDOW_LOGIN:
{
if ( strlen(login->GetText()) == 0 ||
strlen(password->GetText()) == 0)
{
WinManager* win = loginengine->GetWinManager();
//win->ShowOKWindow( \"û?
?û?
??\" );
return true;
}
ConnectToServer();
return true;
}
return false;
}
return false;
}
void LoginWindow::ConnectToServer()
{
// char* account=login->GetText();
//char* code=password->GetText();
// LoginMsg* message=new LoginMsg(login->GetText(),password->GetText());
// ClientNetManager* netmanager = loginengine->GetNetManager();
// netmanager->SendMessage(message);
}
void LoginWindow::HandleMessage(Message* message)
{
/*switch(message->type)
{
case MSG_LOGIN_ACK:
{
LoginAckMsg* recvmessage = new LoginAckMsg(message);
switch( recvmessage->loginAck)
{
case 0:
{
WinManager* win = loginengine->GetWinManager();
win->ShowOKWindow( \"?




?!\" );
return ;
}
case 1:
{
WinManager* win = loginengine->GetWinManager();
win->ShowOKWindow( \"?





!\" );
return ;
}
case 2:
{
WinManager* win = loginengine->GetWinManager();
win->ShowOKWindow( \"?

??,?
¼?

??!\" );
return ;
}
case 3:
{
return ;
}
return ;
}
}
case MSG_CHAR_LIST:
{
WinManager* win = loginengine->GetWinManager();
select=(SelectWindow*)win->FindWidget(\"data/gui/selectperson.xml\");
if(!select)
{
win->LoadWidget(\"data/gui/selectperson.xml\");
select = (SelectWindow*)win->FindWidget(\"selectwindow\");
}
select->HandleMessage(message);
select->Show();
Hide();
return;
}
return ;
}*/
}