Exemple #1
0
void xSceneOpenDlg::OnOK()
{
    CString strFloder, strSceneName;

    CListBox * listFloder = (CListBox *)GetDlgItem(IDC_SceneOpen_Floder);
    CListBox * listScene = (CListBox *)GetDlgItem(IDC_SceneOpen_Scene);

    int isel = listScene->GetCurSel();

    if (isel < 0)
    {
        MessageBox("Please select scene!", "Error", MB_OK);
        return ;
    }

    listScene->GetText(isel, strSceneName);

    if (strSceneName == "")
    {
        MessageBox("Please select scene!", "Error", MB_OK);
        return ;
    }

    isel = listFloder->GetCurSel();
    listFloder->GetText(isel, strFloder);

    d_assert (isel >= 0);

    xScene::Instance()->Load((LPCTSTR)strSceneName, (LPCTSTR)strFloder);

    CDialog::OnOK();
}
Exemple #2
0
void DLGSkill::OnBnClickedSkilldel()
{
   CListBox* pLB = (CListBox*) GetDlgItem(IDC_SkillList);
   if(pLB->GetCurSel() > -1) {
      CSkill::delInfo(pLB->GetCurSel());
      upDate();
   }
}
Exemple #3
0
static RString GetCurrentString( const CListBox &list )
{
	// TODO: Add your control notification handler code here
	int iSel = list.GetCurSel();
	if( iSel == LB_ERR )
		return RString();
	CString s;
	list.GetText( list.GetCurSel(), s );
	return RString( s );
}
Exemple #4
0
void CUserListDlg::OnUserListDblClk() {
	CString username;
	CUserEditDlg dialog;
	CListBox* userList = (CListBox*)GetDlgItem( IDC_USERLIST );
	if ( userList ) {
		if ( userList->GetCurSel() >= 0 ) {
			userList->GetText( userList->GetCurSel(), username );
			dialog.DoModal( (LPCTSTR)username );
			RefreshUserList();
		}
	}
}
Exemple #5
0
bool CFanmotorDlg::GetActiveBridge(CString& BridgeID)
{
    CListBox* listBoxBridges = (CListBox*)GetDlgItem(IDC_BRIDGE_LISTBOX);
    listBoxBridges->SetCurSel(0);
	BridgeID = L"";
	if (listBoxBridges->GetCurSel() < 0) 
	{
		DisplayInforMessageBox((LPCWSTR)L"Error", L"Select Active BRIDGE!");
		return false;
	}
    CBridgeInfo* bridgeInfo = (CBridgeInfo*)listBoxBridges->GetItemDataPtr(listBoxBridges->GetCurSel());
	BridgeID = bridgeInfo->BridgeID;
	return true;
}
Exemple #6
0
void CUserListDlg::OnDeleteUserButton() {
	CString username;
	CListBox* userList = (CListBox*)GetDlgItem( IDC_USERLIST );
	if ( userList ) {
		if ( userList->GetCurSel() >= 0 ) {
			userList->GetText( userList->GetCurSel(), username );
			char temp[10000];
			sprintf( temp, "Are you sure you want to delete the user %s?", (LPCTSTR)username );
			if ( MessageBox( temp, "Student Info", MB_YESNO ) == IDYES ) {
				storage.DeleteUser( (LPCTSTR)username );
				RefreshUserList();
			}
		}
	}
}
Exemple #7
0
void CNewsHubDlg::OnBnClickedSend()
{
  CListBox* pRunningClients = (CListBox*)GetDlgItem(IDC_RUNNING_CLIENTS);

  int row = pRunningClients->GetCurSel();
  if (row == LB_ERR)
  {
    MessageBox(_T("Please select one of running clients to send message through"), _T("No client selected"), MB_OK);
    return;
  }

  CEdit* pMessage = (CEdit*)GetDlgItem(IDC_MESSAGE);
  CString message;
  pMessage->GetWindowText(message);

  ClientLoop* clientLoop = (ClientLoop*)pRunningClients->GetItemDataPtr(row);
  unsigned int messageId = clientLoop->nextMessageId();
  clientLoop->Queue()->AddMessage(messageId, std::string(CT2CA(message)));

  CListBox* pSentMessages = (CListBox*)GetDlgItem(IDC_SENT_MESSAGES);
  NewsHub::TcpClient* tcpClient = (NewsHub::TcpClient*)clientLoop->Client();
  CString str;
  str.Format(_T("(To: %s:%d msgId:%d): %s"), 
    CString(tcpClient->Host().c_str()), tcpClient->Port(), messageId, message);

  row = pSentMessages->AddString(str);

  MessageInfo* messageInfo = new MessageInfo;
  messageInfo->queue = clientLoop->Queue();
  messageInfo->messageId = messageId;
  pSentMessages->SetItemDataPtr(row, messageInfo);

  pSentMessages->SetCurSel(row);
}
Exemple #8
0
void SettingsDlg::OnDeltaposSpinModify(NMHDR *pNMHDR, LRESULT *pResult)
{
	LPNMUPDOWN pNMUpDown = reinterpret_cast<LPNMUPDOWN>(pNMHDR);
	CListBox *listbox;
	CListBox *listbox2;
	listbox = (CListBox*)GetDlgItem(IDC_AUDIO_CODECS_ALL);
	listbox2 = (CListBox*)GetDlgItem(IDC_AUDIO_CODECS);
	if (pNMUpDown->iDelta == -1) {
		//add
		int selected = listbox->GetCurSel();
		if (selected != LB_ERR) 
		{
			CString str;
			listbox->GetText(selected, str);
			listbox2->AddString(str);
			listbox->DeleteString(selected);
			listbox->SetCurSel( selected < listbox->GetCount() ? selected : selected-1 );
		}
	} else {
		//remove
		int selected = listbox2->GetCurSel();
		if (selected != LB_ERR) 
		{
			CString str;
			listbox2->GetText(selected, str);
			listbox->AddString(str);
			listbox2->DeleteString(selected);
			listbox2->SetCurSel( selected < listbox2->GetCount() ? selected : selected-1 );
		}
	}
	*pResult = 0;
}
Exemple #9
0
void xSceneOpenDlg::OnFloderChanged()
{
    CListBox * listFloder = (CListBox *)GetDlgItem(IDC_SceneOpen_Floder);
    CListBox * listScene = (CListBox *)GetDlgItem(IDC_SceneOpen_Scene);

    while (listScene->GetCount())
        listScene->DeleteString(0);

    int isel = listFloder->GetCurSel();

    if (isel < 0)
        return ;

    CString strFloder;

    listFloder->GetText(isel, strFloder);

    ResourceGroup * rg = ResourceManager::Instance()->GetResourceGroup();

    Archive * ar = rg->GetArchive((LPCTSTR)strFloder);

    Archive::FileInfoVisitor v = ar->GetFileInfos();

    while (!v.eof())
    {
        const TString128 & filename = v.Cursor()->second.name;

        if (File::GetExternName(filename) == "scene")
        {
            listScene->AddString(filename.c_str());
        }

        ++v;
    }
}
Exemple #10
0
void CSpellingDialog::OnSelchangeSuggestions() 
{
	// Stick the selected word in the "change to" edit.

	CListBox* pList = (CListBox*)GetDlgItem(IDC_SUGGESTIONS);
	CEdit* pEdit = (CEdit*)GetDlgItem(IDC_CHANGE_TO);
	CString csText;

	if (pEdit != NULL)
	{
		if (pList != NULL)
		{
			TRY
			{
				int nCurSel = pList->GetCurSel();
				if (nCurSel >= 0)
				{
					pList->GetText(nCurSel, csText);
				}
			}
			END_TRY
		}
		// Set the text.
		BOOL fInnerSet = m_fInnerSet;
		m_fInnerSet = TRUE;
		pEdit->SetWindowText(csText);
		m_fInnerSet = fInnerSet;
	}
void CChangeOrderDlg::OnSelchangeEditlist() {
  CListBox *lb = getListBox();
  int i = lb->GetCurSel();
  if(i == lb->GetCount()-1) { // never select the last empty String
    lb->SetSel(lb->GetCount() - 1, false);
  }
}
void CListDlg::OnOK()
{
	CListBox* pListBox = (CListBox*)GetDlgItem(IDC_LISTDIALOG_LIST);
	ASSERT(pListBox != NULL);
	m_nSelection = pListBox->GetCurSel();
	CDialog::OnOK();
}
Exemple #13
0
void CProjectView::OnLibdel() 
{
   int nItem;
   CListBox* pLB = (CListBox*)GetDlgItem(IDP_LIBLIST);
   nItem = pLB->GetCurSel();
   pLB->DeleteString(nItem);
}
Exemple #14
0
void CFuncDialog::OnOK() 
{
    CListBox* pList = (CListBox*)GetDlgItem(IDC_FUNCLIST);
    pList->GetText(pList->GetCurSel(), m_current);
	
	CDialog::OnOK();
}
Exemple #15
0
void CPreferences::OnBnClickedOk()
{
	// Call the funtion
	/// check which check box is sleated
	// Load/Save
	if (IsDlgButtonChecked(IDC_RADIO_SAVE)) { // Save
		CString prefName;
		GetDlgItemText(IDC_EDIT_PREFERENCE_NAME, prefName);
		CListBox *listBox = (CListBox *)GetDlgItem(IDC_LIST_PREFERENCES);
		int indexInListBox = listBox->FindString(-1, prefName);
		if (indexInListBox >= 0) { // Already has this preference name
			if (MessageBox(prefName + _T(" already exists.\nDo you want to overwrite."),
				0, MB_YESNO) == IDNO) {
					CEdit *pEdit((CEdit*)GetDlgItem(IDC_EDIT_PREFERENCE_NAME));
					pEdit->SetFocus();
					pEdit->SetSel(0, -1);
					return;
			}
		}
		SavePreference(prefName);
		listBox->AddString(prefName);
		((CComboBox *)GetDlgItem(IDC_COMBO_DEFPREF))->AddString(prefName);
	}
	else if (IsDlgButtonChecked(IDC_RADIO_LOAD)) { // Load
		CListBox *listBox = (CListBox *)GetDlgItem(IDC_LIST_PREFERENCES);
		int curSel = listBox->GetCurSel();
		if (curSel >= 0) { // User has selected
			CString prefName;
			listBox->GetText(curSel, prefName);
			LoadPreference(prefName);
		}
	}
	else if (IsDlgButtonChecked(IDC_RADIO_DELETE)) { // Delete
		CListBox *listBox = (CListBox *)GetDlgItem(IDC_LIST_PREFERENCES);
		int curSel = listBox->GetCurSel();
		if (curSel >= 0) { // User has selected
			CString prefName;
			listBox->GetText(curSel, prefName);
			if (DeletePreference(prefName)) {
				listBox->DeleteString(curSel);
				CComboBox *pComboBox((CComboBox *)GetDlgItem(IDC_COMBO_DEFPREF));
				pComboBox->DeleteString(pComboBox->FindString(1, prefName));
			}
		}
	}
}
void CSaveMovieDialog::OnButtonUp()
{
	CListBox * pListBox = (CListBox *)GetDlgItem(IDC_LIST_BITMAP_FILENAME);
	if ( pListBox->GetSelCount() != 1 )
		return;

	if ( pListBox->GetCurSel() <= 0 )
		return;

	int sel = pListBox->GetCurSel();
	CString currentText;
	pListBox->GetText (sel, currentText );
	pListBox->InsertString(sel-1 , currentText);
	pListBox->DeleteString(sel+1);

	pListBox->SetSel(sel-1, TRUE);
}
Exemple #17
0
bool CFanmotorDlg::GetActiveDevice(BYTE& DeviceAddress)
{
	DeviceAddress = 255;
	CListBox* listBoxDevices = (CListBox*)GetDlgItem(IDC_DEVICE_LISTBOX);
	listBoxDevices->SetCurSel(0);
	if (listBoxDevices->GetCurSel() < 0) {
		DisplayInforMessageBox((LPCWSTR)L"Error", L"Select Active DEVICE!\r\nPress \"Device List\" button and Select Device");
		return false;
	}
	CString s;
	int n = listBoxDevices->GetTextLen(listBoxDevices->GetCurSel());
	WCHAR *ch, *buf = s.GetBuffer(n);
	listBoxDevices->GetText(listBoxDevices->GetCurSel(), buf);
	DeviceAddress = (BYTE)wcstol(buf,&ch,16);
	s.ReleaseBuffer();
	return true;
}
Exemple #18
0
void CToolBrushDialog::OnLbnSelchangeBrushlist()
{
	CListBox* list = (CListBox*)GetDlgItem(IDC_BRUSHLIST);
	int num = list->GetCurSel();

	CWnd* cView = AfxGetMainWnd()->GetWindow(GW_CHILD);
	::PostMessage(cView->m_hWnd,WM_TRIGMAPID,num,num);
}
Exemple #19
0
void CProjectView::OnDblclkFilelist()
// Open the file in the editor when double clicked
{
   CListBox* pLB = (CListBox*)GetDlgItem(IDP_FILELIST);
   int i = pLB->GetCurSel();
   CString sFile;
   pLB->GetText(i, sFile);
   theApp.WOpen(sFile);
}
Exemple #20
0
void DLGSkill::OnBnClickedSkillload()
{
    // TODO: 在此加入控制項告知處理常式程式碼
    CSkill::read("Skill.fla");
    CListBox* pLB = (CListBox*) GetDlgItem(IDC_SkillList);
    pLB->SetCurSel(0);
    CSkillInfo* pInfo = CSkill::getInfo(pLB->GetCurSel());
    replaceSelSkill(pInfo);
}
Exemple #21
0
void DLGSkill::initDLG()
{
    upDate();
    CListBox* pLB = (CListBox*) GetDlgItem(IDC_SkillList);
    pLB->SetCurSel(0);
    AttrType = BASE_ATTR;
    CSkillInfo* pInfo = CSkill::getInfo(pLB->GetCurSel());
    replaceSelSkill(pInfo);
}
// Cycles among sexp nodes with message text
void event_editor::OnDblclkMessageList() 
{
	CListBox *list = (CListBox*) GetDlgItem(IDC_MESSAGE_LIST);
	int num_messages;
	int message_nodes[MAX_SEARCH_MESSAGE_DEPTH];

	// get current message index and message name
	int cur_index = list->GetCurSel();

	// check if message name is in event tree
	char buffer[256];
	list->GetText(cur_index, buffer);


	num_messages = m_event_tree.find_text(buffer, message_nodes);

	if (num_messages == 0) {
		char message[256];
		sprintf(message, "No events using message '%s'", buffer);
		MessageBox(message);
	} else {
		// find last message_node
		if (m_last_message_node == -1) {
			m_last_message_node = message_nodes[0];
		} else {

			if (num_messages == 1) {
				// only 1 message
				m_last_message_node = message_nodes[0];
			} else {
				// find which message and go to next message
				int found_pos = -1;
				for (int i=0; i<num_messages; i++) {
					if (message_nodes[i] == m_last_message_node) {
						found_pos = i;
						break;
					}
				}

				if (found_pos == -1) {
					// no previous message
					m_last_message_node = message_nodes[0];
				} else if (found_pos == num_messages-1) {
					// cycle back to start
					m_last_message_node = message_nodes[0];
				} else {
					// go to next
					m_last_message_node = message_nodes[found_pos+1];
				}
			}
		}

		// highlight next
		m_event_tree.hilite_item(m_last_message_node);
	}
}
void CSpellBaseParmDlg::OnRemoveTotem() 
{
	CListBox *pList;
	pList = (CListBox *)GetDlgItem(IDC_REQUIRESTOTEM);

	int nCurSel = pList->GetCurSel();
	if (nCurSel != LB_ERR)

	pList->DeleteString(nCurSel);
}
Exemple #24
0
void CSpellingDlg::OnSuggestionsListSelChange() {
	// Copy the new selection to the Change To field.
	CListBox *suggestionsList = (CListBox *)GetDlgItem(IDC_SUGGESTIONSLIST);
	int i = suggestionsList->GetCurSel();
	if (i >= 0) {
		CString selText;
		suggestionsList->GetText(i, selText);
		SetDlgItemText(IDC_CHANGETO, selText);
	}
}
Exemple #25
0
void CDizzyDialog::OnDeleteButton() 
{
	UpdateData(true);
	CListBox* pListBox = (CListBox*) GetDlgItem(IDC_INPUT_LIST);
	if (pListBox->DeleteString(pListBox->GetCurSel()) != LB_ERR) 
	{
		RecalculateRotation();
	}	
	UpdateData(false);
}
Exemple #26
0
void CConnDlg :: OnKillSocket()
{
    CWysApp* pApp = (CWysApp*)AfxGetApp();
    INT iItem;
    CString szTemp;
    SCREENLINE sl;

    // get the current selection
    CWysWnd* pWnd = (CWysWnd*)pApp->m_pMainWnd;
    CListBox* pListBox = (CListBox*)GetDlgItem(IDC_LSTCONN);

    iItem = pListBox->GetCurSel();

    if (iItem == LB_ERR) {
        szTemp.LoadString(IDS_NOSEL);
        this->MessageBox(szTemp, NULL, MB_ICONINFORMATION);
        return;
    }

    // get the socket value
    // for currently selected item
    SOCKET hSocket;
    hSocket = (SOCKET)pListBox->GetItemData(iItem);
    if (hSocket == LB_ERR) {
        szTemp.LoadString(IDS_SOCKERRLST);
        this->MessageBox(szTemp, NULL, MB_ICONINFORMATION);
        return;
    }

    szTemp.LoadString(IDS_KILLSOCK);
    if (this->MessageBox(szTemp, "Kill Connection", MB_ICONQUESTION |
                         MB_YESNO | MB_DEFBUTTON2) == IDYES) {
        CWySock* pSock = (CWySock*)CAsyncSocket::FromHandle(hSocket);
        if (!pSock) {
            szTemp.LoadString(IDS_ERRNOSOCK);
            this->MessageBox(szTemp, NULL, MB_ICONINFORMATION);
            return;
        }

        // add item to screen list
        sl.uColor = COLOR_RED;
        szTemp.LoadString(IDS_SERVKILL);
        sl.szText.Format(szTemp, pSock->IPAddress);
        pWnd->AddListItem(&sl);

        // remove socket from array of connected sockets
        pSock->Close();
        pSock->m_hSocket	= INVALID_SOCKET;
        pSock->State		= FREE;

        //  refresh list
        OnRefresh();
    }
    return;
}
Exemple #27
0
MVegetation * xTerrainVegDlg::GetCurVeg()
{
	CListBox * list = (CListBox *)GetDlgItem(IDC_TV_List);

	int curSel = list->GetCurSel();

	if (curSel == -1)
		return NULL;

	return MForest::Instance()->GetVegetation(curSel);
}
void CDlgReplaceBox::OnSelchangeList() 
{
	CListBox*	theListBox 	= (CListBox*) GetDlgItem( FINDGET_LIST );
	int			WhichItem 	= theListBox->GetCurSel();

 	if (WhichItem != LB_ERR)
	{
		m_Symbol = static_cast<CLibraryStoreSymbol *>(theListBox->GetItemDataPtr( WhichItem ));
		GetDlgItem( IDC_SHOW_SYMBOL )->RedrawWindow();
	}		
}
Exemple #29
0
void DLGSkill::OnLbnSelchangeSkillmotioneffects()
{
    // TODO: 在此加入控制項告知處理常式程式碼
    CSkillInfo* pInfo = getSkillInfo();
    if(NULL == pInfo)
    {
        return;
    }
    CListBox* pLB = (CListBox*) GetDlgItem(IDC_SkillMotionEffects);
    int oriSel = pLB->GetCurSel();
}
Exemple #30
0
void CFuncDialog::OnSelchangeFunclist() 
{
    CHawkApp* app = (CHawkApp*)AfxGetApp();
    CStatic* tip = (CStatic*)GetDlgItem(IDC_FUNCTIP);
    CListBox* pList = (CListBox*)GetDlgItem(IDC_FUNCLIST);
    CString current;
    pList->GetText(pList->GetCurSel(), current);

    current = app->GenDecl(current);
    tip->SetWindowText(current);
}