BOOL ClsPanel::Create( LPCTSTR pszTitle, ClsRect& rcBounds ) { // Create the control. if ( ClsWindow::Create( 0, NULL, NULL, WS_CLIPCHILDREN, rcBounds, NULL, NULL )) { // Setup it's caption. if ( SetPanelTitle( pszTitle )) return TRUE; // Failed... Destroy(); } return FALSE; }
//选择框消息处理 void CChoosePanel::ReceiveMsg(CMessage msg) { switch(msg.type) { //打开选择框,设置选项数目和标题 case DEMO_MSG::MSG_OPEN_CHOOSE_PANEL: { SetNumOfItem(msg.p1); SetPanelTitle(*((std::string* )msg.p3)); } break; //添加选项 case DEMO_MSG::MSG_SET_CHOOSE_ITEM: { AddItem(msg.p1, *((std::string* )msg.p3)); //所有选项添加完成 if (m_ChooseItems.size() > 0 && m_ChooseItems.size() == m_nNumOfItem) { for(TChooseItems::iterator iter = m_ChooseItems.begin(); iter != m_ChooseItems.end(); iter++) { m_pGui->AddCtrl(*iter); } m_pGui->SetNavMode(HGEGUI_UPDOWN | HGEGUI_CYCLED); m_pGui->SetFocus(m_ChooseItems[0]->GetId()); m_pGui->Enter(); //设置选择状态 __SetChoosing(true); //设置选择框可见 SetVisible(true); } } break; } }