本文整理汇总了C++中CComboBox::FindStringExact方法的典型用法代码示例。如果您正苦于以下问题:C++ CComboBox::FindStringExact方法的具体用法?C++ CComboBox::FindStringExact怎么用?C++ CComboBox::FindStringExact使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CComboBox
的用法示例。
在下文中一共展示了CComboBox::FindStringExact方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: find_event
int CMessageEditorDlg::find_event()
{
char *str;
int i, formula, node;
CComboBox *box;
for (i=0; i<Num_mission_events; i++) {
node = Mission_events[i].formula;
if (find_operator(CTEXT(node)) == OP_WHEN) {
node = CDR(node);
formula = CAR(node); // bool conditional
if (CDR(CDR(node)) == -1) { // only 1 action
node = CADR(node);
if ((find_operator(CTEXT(node)) == OP_SEND_MESSAGE) && !stricmp(CTEXT(CDR(CDR(CDR(node)))), m_message_name)) {
box = (CComboBox *) GetDlgItem(IDC_SENDER);
str = CTEXT(CDR(node));
m_sender = box->FindStringExact(-1, str);
if (m_sender == CB_ERR)
m_sender = 0;
box = (CComboBox *) GetDlgItem(IDC_PRIORITY);
str = CTEXT(CDR(CDR(node)));
m_priority = box->FindStringExact(-1, str);
if (m_priority == CB_ERR)
m_priority = 0;
return i;
}
}
}
}
m_sender = m_priority = 0;
return -1;
}
示例2: OnInitDialog
LRESULT FindView::OnInitDialog(UINT/*uMsg*/, WPARAM/*wParam*/, LPARAM/*lParam*/, BOOL&/*bHandled*/)
{
this->SetWindowText(_T("Find View"));
updateDimensionList();
CComboBox cb = GetDlgItem(IDC_DIMENSION_COMBO);
if (cb.GetCount() > 0)
{
int index = CB_ERR;
if (!m_settings->getValue(_T("DefaultDimension")).empty())
{
index = cb.FindStringExact(-1, m_settings->getValue(_T("DefaultDimension")).c_str());
}
if (index == CB_ERR)
{
index = 0;
}
cb.SetCurSel(index);
updateCharList(cb.GetItemData(index));
m_lastQueryDimension = cb.GetItemData(index);
CComboBox toon_combo = GetDlgItem(IDC_CHARCOMBO);
if (toon_combo.GetCount() > 0)
{
toon_combo.SetCurSel(0);
}
}
DlgResize_Init(false, true, WS_CLIPCHILDREN);
return 0;
}
示例3: GetFindText
int FindReplDlg::GetFindText(CComboBox& wnd, bsString& text)
{
int len;
char *tp;
int sel = wnd.GetCurSel();
if (sel == -1)
{
len = wnd.GetWindowTextLength()+1;
tp = new char[len];
wnd.GetWindowText(tp, len);
sel = wnd.FindStringExact(-1, tp);
if (sel == -1)
{
sel = wnd.InsertString(0, tp);
wnd.SetCurSel(sel);
}
int cnt;
while ((cnt = wnd.GetCount()) >= 20)
wnd.DeleteString(cnt-1);
}
else
{
len = wnd.GetLBTextLen(sel)+1;
tp = new char[len];
wnd.GetLBText(sel, tp);
}
text.Attach(tp);
return sel;
}
示例4: EnumRecentlyUsed
// the sub-class can call this method to fill out a combo box with the values stored in
// the recently used list.
void CAutoConfigDlg::EnumRecentlyUsed(CComboBox& cbRecentlyUsed)
{
cbRecentlyUsed.Clear();
CRegKey keyRecentConverterIDs;
CString strRegKey = GetRegKey();
if( keyRecentConverterIDs.Open(HKEY_CURRENT_USER, strRegKey) == ERROR_SUCCESS )
{
DWORD dwIndex = 0;
BOOL bStop = false;
do
{
DWORD dwValueType = 0, cbName = _MAX_PATH;
TCHAR lpName[_MAX_PATH]; lpName[0] = 0;
LONG lVal = RegEnumValue(keyRecentConverterIDs,dwIndex++,lpName,&cbName,0,&dwValueType,0,0);
if( (lVal == ERROR_SUCCESS) || (lVal == ERROR_MORE_DATA) )
{
// skip the default value
if( _tcslen(lpName) > 0 )
{
TRACE(_T("Found: (%s)"), lpName);
if( cbRecentlyUsed.FindStringExact(0,lpName) < 0 )
cbRecentlyUsed.AddString(lpName);
}
}
else
bStop = true;
} while( !bStop );
// select the first one so there's something in it.
cbRecentlyUsed.SetCurSel(0);
}
}
示例5: OnOK
void CServiceManage::OnOK()
{
BOOL rc;
// TODO: Add extra validation here
UpdateData(TRUE);
CComboBox *cbStartup = (CComboBox *)GetDlgItem(IDC_COMBO_STARTUP);
if (cbStartup) {
m_nStartmode = cbStartup->GetCurSel();
} else {
m_nStartmode = CB_ERR;
}
if (m_nStartmode == CB_ERR) {
AfxMessageBox("Invalid startup mode !", MB_OK|MB_ICONWARNING);
return;
}
if (m_Codepage.IsEmpty()) {
AfxMessageBox("You must select a codepage type.", MB_OK|MB_ICONWARNING);
return;
}
CComboBox *cbCodepage = (CComboBox *)GetDlgItem(IDC_COMBO_CODEPAGE);
if (cbCodepage) {
int rc = cbCodepage->FindStringExact(-1, m_Codepage);
if (rc == CB_ERR) {
AfxMessageBox("Invalid codepage type: "+m_Codepage, MB_OK|MB_ICONWARNING);
return;
}
}
if (AfxMessageBox("Current service settings will be overwritten,\ndo you want continue ?",
MB_YESNO | MB_ICONQUESTION) != IDYES) {
return;
}
rc = Ext2SetGlobalProperty(
m_nStartmode,
(BOOLEAN)m_bReadonly,
(BOOLEAN)m_bExt3Writable,
m_Codepage.GetBuffer(CODEPAGE_MAXLEN),
m_sPrefix.GetBuffer(HIDINGPAT_LEN),
m_sSuffix.GetBuffer(HIDINGPAT_LEN),
(BOOLEAN)m_bAutoMount
);
if (rc) {
/*
AfxMessageBox("Ext2 service settings updated successfully !",
MB_OK | MB_ICONINFORMATION);
*/
CDialog::OnOK();
} else {
AfxMessageBox("Failed to save the service settings !",
MB_OK | MB_ICONWARNING);
}
}
示例6: AddStrToComboBox
//
// 向组合框追加字符串
//
bool AddStrToComboBox(CString &str, CComboBox &cb)
{
if (!str.IsEmpty() && (cb.FindStringExact(-1, str)) == CB_ERR) // 1、大小写不敏感;2、首尾空格有效。
{
cb.AddString(str);
return TRUE;
}
return FALSE;
}
示例7: SetupWaveletPar
void CFilterWaveletDlg::SetupWaveletPar()
{
GetDlgItem(IDC_WAVELET_PAR)->EnableWindow(m_nWaveletType>=2 && m_nWaveletType!=5);
CComboBox* p = (CComboBox*)GetDlgItem(IDC_WAVELET_PAR);
p->ResetContent();
CString sTemp;
switch(m_nWaveletType)
{
case 5: // Vaidyanathan
case 0: // Haar
case 1: // Beylkin
p->AddString("...");
break;
case 2: { // Coiflet
for(int i=1; i<=5; i++)
{
sTemp.Format("%d", i);
p->AddString(sTemp);
}
} break;
case 3: { // Daubechies
for(int i=4; i<=20; i+=2)
{
sTemp.Format("%d", i);
p->AddString(sTemp);
}
} break;
case 4: { // Symmlet
for(int i=4; i<=10; i++)
{
sTemp.Format("%d", i);
p->AddString(sTemp);
}
} break;
case 6: { // Battle-Lemarie
for(int i=1; i<=5; i+=2)
{
sTemp.Format("%d", i);
p->AddString(sTemp);
}
} break;
default: // Undefined
cerr << "Undefined wavelet type (" << m_nWaveletType << ").\n";
return;
}
// try to set the new wavelet parameter setting to be the same as the old one
sTemp.Format("%d", m_nWaveletPar);
m_nWaveletPar = p->FindStringExact(-1,sTemp);
if(m_nWaveletPar == CB_ERR)
m_nWaveletPar = 0;
p->SetCurSel(m_nWaveletPar);
}
示例8: SetFilterCheck
void CBaseRecordsDlg::SetFilterCheck(CFlashRecord* pRecord)
{
CComboBox* pComboVendor = (CComboBox*)GetDlgItem(IDC_FILTER_VENDOR);
CComboBox* pComboTotalSize = (CComboBox*)GetDlgItem(IDC_FILTER_TOTAL_SIZE);
CComboBox* pComboPageSize = (CComboBox*)GetDlgItem(IDC_FILTER_PAGE_SIZE);
CComboBox* pComboBus = (CComboBox*)GetDlgItem(IDC_FILTER_BUS);
CComboBox* pComboCS = (CComboBox*)GetDlgItem(IDC_FILTER_CS);
m_nFilterID = pRecord ? pRecord->m_nID : NO_FILTER_ID;
m_nFilterCS = pRecord ? pRecord->m_nCountCS : NO_FILTER_VALUE;
pComboCS->SetCurSel(pRecord ? pRecord->m_nCountCS : 0);
m_nFilterBus = pRecord ? pRecord->m_nBusWidth : NO_FILTER_VALUE;;
pComboBus->SetCurSel(pRecord ? pComboBus->FindStringExact(-1, CFlashRecord::GetStringBusWidth(pRecord->m_nBusWidth)) : 0);
m_nFilterVendor = NO_FILTER_VALUE;
pComboVendor->SetCurSel(0);
m_strFilterTotalSize = NO_FILTER_STR;
pComboTotalSize->SetCurSel(0);
m_nFilterPageSize = NO_FILTER_VALUE;
pComboPageSize->SetCurSel(0);
ShowRecords();
}
示例9: SetCurSel
// ****************************************************************************
//
// Function Name: RMFCCommandUI::SetCurSel( )
//
// Description: This function is for when the update must be for a
// combobox. If the RMFCCommandUI object is a combobox or has
// a child combobox, this checks the combobox to see if the
// string passed in has been loaded. If it has, this sets
// the combobox selection to that string; otherwise, it
// clears the combobox selection.
//
// Returns: Nothing
//
// Exceptions: None
//
// ****************************************************************************
//
void RMFCCommandUI::SetCurSel( const RMBCString& string )
{
TpsAssert( m_pCmdUI->m_pMenu == NULL, "CommandUI object is not a control" );
TpsAssert( m_pCmdUI->m_pOther, "m_pCmdUI->m_pOther is NULL" );
HWND hWnd = m_pCmdUI->m_pOther->GetSafeHwnd();
CWnd* pWnd = NULL;
while ( hWnd )
{
pWnd = pWnd->FromHandle( hWnd );
if ( pWnd->IsKindOf( RUNTIME_CLASS( CComboBox ) ) )
{
CComboBox* pComboBox = ( CComboBox* )pWnd;
pComboBox->SetCurSel( pComboBox->FindStringExact( -1, string ) );
break;
}
else
hWnd = ::GetWindow( hWnd, GW_CHILD );
}
}
示例10: OnInitDialog
BOOL COptionPageLanguage::OnInitDialog()
{
CMFCPropertyPage::OnInitDialog();
//Set URLs
CString DictURL;
DictURL.LoadString(ID_URL_TCDICTDOWNLOAD);
int idLastLineBreak = DictURL.ReverseFind(_T('\n'));
ASSERT(idLastLineBreak > 0);
m_wndURLDownloadDicts.SetURL(DictURL.Mid(idLastLineBreak + 1));
m_wndURLDownloadDicts.SizeToContent(true,true);
FindDictionaries();
CComboBox *pLangBox = (CComboBox*)GetDlgItem(IDC_OPTIONS_LANGUAGE);
// Add all the found languages
for (int i = 0; i < m_aLanguage.GetSize(); ++i)
{
if (pLangBox->FindString(0,m_aLanguage[i]) == CB_ERR)
pLangBox->AddString(m_aLanguage[i]);
}
// Select the language
int nSel = pLangBox->FindStringExact(0,m_strLanguageDefault);
if (nSel == CB_ERR)
pLangBox->SetCurSel(0);
else
pLangBox->SetCurSel(nSel);
OnSelchangeOptionsLanguage();
UpdateControlStates();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
示例11: OnSelchangeOptionsLanguage
void COptionPageLanguage::OnSelchangeOptionsLanguage()
{
CComboBox *pDialBox = (CComboBox*)GetDlgItem(IDC_OPTIONS_LANGUAGE_DIALECT);
CComboBox *pLangBox = (CComboBox*)GetDlgItem(IDC_OPTIONS_LANGUAGE);
pDialBox->ResetContent();
if (pLangBox->GetCurSel() == -1)
return;
CString lang;
pLangBox->GetLBText(pLangBox->GetCurSel(),lang);
for (int i = 0; i < m_aDialect.GetSize(); ++i)
{
if (lang == m_aLanguage[i])
pDialBox->AddString(m_aDialect[i]);
}
// Select the dialect
int nSel = pDialBox->FindStringExact(0,m_strDialectDefault);
if (nSel == CB_ERR)
pDialBox->SetCurSel(0);
else
pDialBox->SetCurSel(nSel);
}
示例12: OnInitDialog
//.........这里部分代码省略.........
m_event_tree.hilite_item(i);
r = FALSE;
}
m_num_messages = Num_messages - Num_builtin_messages;
for (i=0; i<m_num_messages; i++) {
msg = Messages[i + Num_builtin_messages];
m_messages.push_back(msg);
if (m_messages[i].avi_info.name){
m_messages[i].avi_info.name = strdup(m_messages[i].avi_info.name);
}
if (m_messages[i].wave_info.name){
m_messages[i].wave_info.name = strdup(m_messages[i].wave_info.name);
}
}
((CEdit *) GetDlgItem(IDC_MESSAGE_NAME))->LimitText(NAME_LENGTH - 1);
((CEdit *) GetDlgItem(IDC_MESSAGE_TEXT))->LimitText(MESSAGE_LENGTH - 1);
((CComboBox *) GetDlgItem(IDC_AVI_FILENAME))->LimitText(MAX_FILENAME_LEN - 1);
((CComboBox *) GetDlgItem(IDC_WAVE_FILENAME))->LimitText(MAX_FILENAME_LEN - 1);
list = (CListBox *) GetDlgItem(IDC_MESSAGE_LIST);
list->ResetContent();
for (i=0; i<m_num_messages; i++) {
list->AddString(m_messages[i].name);
}
box = (CComboBox *) GetDlgItem(IDC_AVI_FILENAME);
box->ResetContent();
box->AddString("<None>");
for (i=0; i<Num_messages; i++) {
if (Messages[i].avi_info.name) {
maybe_add_head(box, Messages[i].avi_info.name);
}
}
// add new heads, if not already in
maybe_add_head(box, "Head-TP2");
maybe_add_head(box, "Head-VC2");
maybe_add_head(box, "Head-TP4");
maybe_add_head(box, "Head-TP5");
maybe_add_head(box, "Head-TP6");
maybe_add_head(box, "Head-TP7");
maybe_add_head(box, "Head-TP8");
maybe_add_head(box, "Head-VP2");
maybe_add_head(box, "Head-VP2");
maybe_add_head(box, "Head-CM2");
maybe_add_head(box, "Head-CM3");
maybe_add_head(box, "Head-CM4");
maybe_add_head(box, "Head-CM5");
maybe_add_head(box, "Head-BSH");
/*
box->AddString("Head-VC"); // force it in, since Sandeep wants it and it's not used in built-in messages
box->AddString("Head-VC2");
// add terran pilot heads
box->AddString("Head-TP4");
box->AddString("Head-TP5");
box->AddString("Head-TP6");
box->AddString("Head-TP7");
box->AddString("Head-TP8");
// add vasudan pilot heads
box->AddString("Head-VP2");
// BSH and CM2
box->AddString("Head-CM2");
box->AddString("Head-BSH");
*/
box = (CComboBox *) GetDlgItem(IDC_WAVE_FILENAME);
box->ResetContent();
box->AddString("<None>");
for (i=0; i<Num_messages; i++){
if (Messages[i].wave_info.name){
if (box->FindStringExact(i, Messages[i].wave_info.name) == CB_ERR){
box->AddString(Messages[i].wave_info.name);
}
}
}
// add the persona names into the combo box
box = (CComboBox *) GetDlgItem(IDC_PERSONA_NAME);
box->ResetContent();
box->AddString("<None>");
for (i = 0; i < Num_personas; i++ ){
box->AddString( Personas[i].name );
}
// set the first message to be the first non-builtin message (if it exists)
if ( Num_messages > Num_builtin_messages ){
m_cur_msg = 0;
} else {
m_cur_msg = -1;
}
update_cur_message();
return r;
}
示例13: SetFilters
void CBaseRecordsDlg::SetFilters(BOOL bSaveSelection)
{
CFlashRecord* pRecord;
CVendorRecord* pVendor;
CComboBox* pComboVendor = (CComboBox*)GetDlgItem(IDC_FILTER_VENDOR);
CComboBox* pComboTotalSize = (CComboBox*)GetDlgItem(IDC_FILTER_TOTAL_SIZE);
CComboBox* pComboPageSize = (CComboBox*)GetDlgItem(IDC_FILTER_PAGE_SIZE);
CComboBox* pComboBus = (CComboBox*)GetDlgItem(IDC_FILTER_BUS);
CComboBox* pComboCS = (CComboBox*)GetDlgItem(IDC_FILTER_CS);
CString strVendor;
CString strTotalSize;
CString strPageSize;
CString strBus;
CString strCS;
CString strTemp;
int nInd;
if (bSaveSelection)
{
pComboVendor->GetLBText(pComboVendor->GetCurSel(), strVendor);
pComboTotalSize->GetLBText(pComboTotalSize->GetCurSel(), strTotalSize);
pComboPageSize->GetLBText(pComboPageSize->GetCurSel(), strPageSize);
pComboBus->GetLBText(pComboBus->GetCurSel(), strBus);
pComboCS->GetLBText(pComboCS->GetCurSel(), strCS);
}
pComboVendor->ResetContent();
pComboVendor->SetItemData(pComboVendor->AddString(NO_FILTER_STR), NO_FILTER_VALUE);
pComboTotalSize->ResetContent();
pComboTotalSize->SetItemData(pComboTotalSize->AddString(NO_FILTER_STR), NO_FILTER_VALUE);
pComboPageSize->ResetContent();
pComboPageSize->SetItemData(pComboPageSize->AddString(NO_FILTER_STR), NO_FILTER_VALUE);
pComboBus->ResetContent();
pComboBus->SetItemData(pComboBus->AddString(NO_FILTER_STR), NO_FILTER_VALUE);
pComboCS->ResetContent();
pComboCS->SetItemData(pComboCS->AddString(NO_FILTER_STR), NO_FILTER_VALUE);
for (POSITION nPosRecord = m_database.GetRecordHeadPosition(); nPosRecord != NULL; )
{
pRecord = m_database.GetRecordNext(nPosRecord);
strTemp.Empty();
for (POSITION nPosVendor = m_database.GetVendorHeadPosition(); nPosVendor != NULL; )
{
pVendor = m_database.GetVendorNext(nPosVendor);
if (pVendor->m_nID != pRecord->m_nVendorID) continue;
strTemp = pVendor->m_strVendor;
break;
}
if (CB_ERR == pComboVendor->FindStringExact(-1, strTemp))
{
pComboVendor->SetItemData(pComboVendor->AddString(strTemp), pRecord->m_nVendorID);
}
strTemp = pRecord->GetStringSize();
if (CB_ERR == pComboTotalSize->FindStringExact(-1, strTemp))
{
pComboTotalSize->SetItemData(pComboTotalSize->AddString(strTemp), 0);
}
strTemp = pRecord->GetStringPageSize();
if (CB_ERR == pComboPageSize->FindStringExact(-1, strTemp))
{
pComboPageSize->SetItemData(pComboPageSize->AddString(strTemp), pRecord->m_nPageSize);
}
strTemp = CFlashRecord::GetStringBusWidth(pRecord->m_nBusWidth);
if (CB_ERR == pComboBus->FindStringExact(-1, strTemp))
{
pComboBus->SetItemData(pComboBus->AddString(strTemp), pRecord->m_nBusWidth);
}
strTemp.Format(_T("%d CE"), pRecord->m_nCountCS);
if (CB_ERR == pComboCS->FindStringExact(-1, strTemp))
{
pComboCS->SetItemData(pComboCS->AddString(strTemp), pRecord->m_nCountCS);
}
}
nInd = pComboVendor->FindStringExact(-1, strVendor);
if (CB_ERR == nInd) nInd = 0;
m_nFilterVendor = pComboVendor->GetItemData(nInd);
pComboVendor->SetCurSel(nInd);
nInd = pComboTotalSize->FindStringExact(-1, strTotalSize);
if (CB_ERR == nInd) nInd = 0;
pComboTotalSize->GetLBText(nInd, m_strFilterTotalSize);
pComboTotalSize->SetCurSel(nInd);
nInd = pComboPageSize->FindStringExact(-1, strPageSize);
if (CB_ERR == nInd) nInd = 0;
m_nFilterPageSize = pComboPageSize->GetItemData(nInd);
pComboPageSize->SetCurSel(nInd);
nInd = pComboBus->FindStringExact(-1, strBus);
if (CB_ERR == nInd) nInd = 0;
m_nFilterBus = pComboBus->GetItemData(nInd);
pComboBus->SetCurSel(nInd);
nInd = pComboCS->FindStringExact(-1, strCS);
if (CB_ERR == nInd) nInd = 0;
m_nFilterCS = pComboCS->GetItemData(nInd);
pComboCS->SetCurSel(nInd);
}
示例14: PreTranslateMessage
BOOL CDynToolBar::PreTranslateMessage(MSG* pMsg)
{// Handle a few messages for our children...
CWnd* pWnd = FromHandle(pMsg->hwnd); //Get a temp CWnd object for the message we're processing.
//if (pMsg->message!=WM_PAINT)
// {
// sprintf(buff, "H=%08x ", (DWORD)(pWnd->m_hWnd));
// dbgWM_Msg(buff, pMsg->message, pMsg->wParam, pMsg->lParam, 1);
// }
if (IsChild(pWnd))
{//It's a child of ours...
CWnd* pParent = pWnd->GetParent();
if (pParent && pParent->IsKindOf(RUNTIME_CLASS(CComboBox)))
{//The parent is a ComboBox!
switch (pMsg->message)
{
case WM_KEYDOWN:
if (pMsg->wParam==VK_RETURN)
{
int Index = FindComboButtonIndex(pParent);
if (Index>=0)
{
int IDIndex = FindComboButtonIDIndex(Index);
if (IDIndex>=0)
{
CComboBox* pCBox = (CComboBox*)pParent;
int nIndex = pCBox->GetCurSel();
if (nIndex==CB_ERR)
{
pCBox->GetWindowText(sCurSel);
if (sCurSel.GetLength()>0 && pCBox->FindStringExact(-1, (const char*)sCurSel)==CB_ERR)
{
bComboListChanged = 1;
pCBox->InsertString(0, (const char*)sCurSel);
pCBox->SetCurSel(0);
}
}
else
{
pCBox->GetLBText(nIndex, sCurSel);
if (nIndex>0)
{
bComboListChanged = 1;
pCBox->DeleteString(nIndex);
pCBox->InsertString(0, (const char*)sCurSel);
pCBox->SetCurSel(0);
}
}
ScdMainWnd()->PostMessage(WM_COMMAND, BtnIDs[IDIndex]);
}
}
}
else if (bUseEscape && pMsg->wParam==VK_ESCAPE)
{
ScdMainWnd()->PostMessage(WM_COMMAND, ID_GRF_Esc);
}
break;
}//end switch
}
else if (pParent && pParent->IsKindOf(RUNTIME_CLASS(CEdit)))
{//The parent is a CEdit!
switch (pMsg->message)
{
case WM_KEYDOWN:
if (pMsg->wParam==VK_RETURN)
{
ScdMainWnd()->PostMessage(WM_COMMAND, ID_GRF_Done);
}
else if (bUseEscape && pMsg->wParam==VK_ESCAPE)
{
ScdMainWnd()->PostMessage(WM_COMMAND, ID_GRF_Esc);
}
break;
}//end switch
}
}
return CToolBar::PreTranslateMessage(pMsg);
}
示例15: OnInitDialog
BOOL CMessageEditorDlg::OnInitDialog()
{
int i;
CListBox *list;
CComboBox *box;
CDialog::OnInitDialog();
theApp.init_window(&Messages_wnd_data, this);
m_tree.setup();
((CEdit *) GetDlgItem(IDC_NAME))->LimitText(NAME_LENGTH - 1);
((CEdit *) GetDlgItem(IDC_MESSAGE_TEXT))->LimitText(MESSAGE_LENGTH - 1);
((CComboBox *) GetDlgItem(IDC_AVI_FILENAME))->LimitText(MAX_FILENAME_LEN - 1);
((CComboBox *) GetDlgItem(IDC_WAVE_FILENAME))->LimitText(MAX_FILENAME_LEN - 1);
list = (CListBox *) GetDlgItem(IDC_MESSAGE_LIST);
list->ResetContent();
for (i=0; i<Num_messages; i++) {
//Assert(list->FindStringExact(-1, Messages[i].name) == CB_ERR);
// mwa we should probably not include builtin messages into this list!
list->AddString(Messages[i].name);
}
box = (CComboBox *) GetDlgItem(IDC_AVI_FILENAME);
for (i=0; i<Num_messages; i++)
if (Messages[i].avi_info.name)
if (box->FindStringExact(-1, Messages[i].avi_info.name) == CB_ERR)
box->AddString(Messages[i].avi_info.name);
box = (CComboBox *) GetDlgItem(IDC_WAVE_FILENAME);
for (i=0; i<Num_messages; i++)
if (Messages[i].wave_info.name)
if (box->FindStringExact(i, Messages[i].wave_info.name) == CB_ERR)
box->AddString(Messages[i].wave_info.name);
// add the persona names into the combo box
box = (CComboBox *)GetDlgItem(IDC_PERSONA_NAME);
box->ResetContent();
box->AddString("<None>");
for (i = 0; i < Num_personas; i++ )
box->AddString( Personas[i].name );
box = (CComboBox *) GetDlgItem(IDC_SENDER);
for (i=0; i<MAX_SHIPS; i++)
if ((Ships[i].objnum >= 0) && (Objects[Ships[i].objnum].type == OBJ_SHIP))
box->AddString(Ships[i].ship_name);
for (i=0; i<MAX_WINGS; i++)
if (Wings[i].wave_count)
box->AddString(Wings[i].name);
box->AddString("<Any wingman>");
// MWA 4/7/98 -- removed any allied
//box->AddString("<Any allied>");
// set the first message to be the first non-builtin message (if it exists)
if ( Num_messages > Num_builtin_messages )
m_cur_msg = Num_builtin_messages;
else if (Num_messages)
m_cur_msg = 0;
else
m_cur_msg = -1;
if (Num_messages >= MAX_MISSION_MESSAGES)
GetDlgItem(IDC_NEW)->EnableWindow(FALSE);
update_cur_message();
return TRUE;
}