本文整理汇总了C++中CEdit::Attach方法的典型用法代码示例。如果您正苦于以下问题:C++ CEdit::Attach方法的具体用法?C++ CEdit::Attach怎么用?C++ CEdit::Attach使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CEdit
的用法示例。
在下文中一共展示了CEdit::Attach方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnTextChanged
LRESULT FavHubProperties::OnTextChanged(WORD /*wNotifyCode*/, WORD wID, HWND hWndCtl, BOOL& /*bHandled*/)
{
TCHAR buf[256];
GetDlgItemText(wID, buf, 256);
tstring old = buf;
// Strip '$', '|' and ' ' from text
TCHAR *b = buf, *f = buf, c;
while( (c = *b++) != 0 )
{
if(c != '$' && c != '|' && (wID == IDC_HUBUSERDESCR || c != ' ') && ( (wID != IDC_HUBNICK) || (c != '<' && c != '>')) )
*f++ = c;
}
*f = '\0';
if(old != buf)
{
// Something changed; update window text without changing cursor pos
CEdit tmp;
tmp.Attach(hWndCtl);
int start, end;
tmp.GetSel(start, end);
tmp.SetWindowText(buf);
if(start > 0) start--;
if(end > 0) end--;
tmp.SetSel(start, end);
tmp.Detach();
}
return TRUE;
}
示例2: getItem
bool AsGroupsDlg::getItem(tstring& name, bool checkSel) {
{
CEdit wnd;
wnd.Attach(GetDlgItem(IDC_NAME));
name = WinUtil::getEditText(wnd);
wnd.Detach();
if (name.empty()) {
MessageBox(_T("You must enter a group name!"), CTSTRING(MANAGE_GROUPS), MB_ICONERROR);
return false;
}
else {
int32_t pos = findGroup(name.c_str());
if (pos != -1 && (checkSel == false || pos != ctrlGroups.GetSelectedIndex())) {
MessageBox(_T("Item already exists!"), CTSTRING(MANAGE_GROUPS), MB_ICONERROR);
return false;
}
}
}
return true;
}
示例3: updateSelectedGroup
void AsGroupsDlg::updateSelectedGroup(bool forceClean /*= false*/) {
tstring name;
bool enableButtons = false;
if (ctrlGroups.GetSelectedIndex() != -1) {
if (forceClean == false) {
name = getText(0);
}
enableButtons = true;
}
{
CWindow wnd;
wnd.Attach(GetDlgItem(IDC_REMOVE));
wnd.EnableWindow(enableButtons);
wnd.Detach();
wnd.Attach(GetDlgItem(IDC_UPDATE));
wnd.EnableWindow(enableButtons);
wnd.Detach();
wnd.Attach(GetDlgItem(IDC_MOVE_DOWN));
wnd.EnableWindow(enableButtons);
wnd.Detach();
wnd.Attach(GetDlgItem(IDC_MOVE_UP));
wnd.EnableWindow(enableButtons);
wnd.Detach();
}
{
CEdit wnd;
wnd.Attach(GetDlgItem(IDC_NAME));
wnd.SetWindowText(name.c_str());
wnd.Detach();
}
}
示例4: OnInitDialog
LRESULT FavHubProperties::OnInitDialog(UINT, WPARAM, LPARAM, BOOL&)
{
// Translate dialog
SetWindowText(CTSTRING(FAVORITE_HUB_PROPERTIES));
SetDlgItemText(IDCANCEL, CTSTRING(CANCEL));
SetDlgItemText(IDC_FH_HUB, CTSTRING(HUB));
SetDlgItemText(IDC_FH_IDENT, CTSTRING(FAVORITE_HUB_IDENTITY));
SetDlgItemText(IDC_FH_NAME, CTSTRING(HUB_NAME));
SetDlgItemText(IDC_FH_ADDRESS, CTSTRING(HUB_ADDRESS));
SetDlgItemText(IDC_FH_HUB_DESC, CTSTRING(DESCRIPTION));
SetDlgItemText(IDC_FH_NICK, CTSTRING(NICK));
SetDlgItemText(IDC_FH_PASSWORD, CTSTRING(PASSWORD));
SetDlgItemText(IDC_FH_USER_DESC, CTSTRING(DESCRIPTION));
SetDlgItemText(IDC_FH_CONN, CTSTRING(FAVORITE_HUB_CONNECTION));
SetDlgItemText(IDC_STEALTH, CTSTRING(STEALTH_MODE));
SetDlgItemText(IDC_FAV_NO_PM, CTSTRING(FAV_NO_PM));
SetDlgItemText(IDC_SHOW_JOIN, CTSTRING(FAV_SHOW_JOIN));
SetDlgItemText(IDC_HIDE_SHARE, CTSTRING(HIDE_SHARE));
SetDlgItemText(IDC_FAV_SEARCH_INTERVAL, CTSTRING(MINIMUM_SEARCH_INTERVAL));
SetDlgItemText(IDC_FAVGROUP, CTSTRING(GROUP));
SetDlgItemText(IDC_LOGMAINCHAT, CTSTRING(FAV_LOG_CHAT));
SetDlgItemText(IDC_CHAT_NOTIFY, CTSTRING(CHAT_NOTIFY));
SetDlgItemText(IDC_FAILOVER, CTSTRING(ACCEPT_FAILOVERS_FAV));
SetDlgItemText(IDC_AWAY_MSG_LBL, CTSTRING(CUSTOM_AWAY_MESSAGE));
SetDlgItemText(IDC_LOGMAINCHAT, CTSTRING(FAV_LOG_CHAT));
SetDlgItemText(IDC_HUBSETTINGS, CTSTRING(GLOBAL_SETTING_OVERRIDES));
SetDlgItemText(IDC_SEARCH_INTERVAL_DEFAULT, CTSTRING(USE_DEFAULT));
SetDlgItemText(IDC_FAV_SHAREPROFILE_CAPTION, CTSTRING(SHARE_PROFILE));
SetDlgItemText(IDC_EDIT_PROFILES, CTSTRING(EDIT_PROFILES));
SetDlgItemText(IDC_PROFILES_NOTE, CTSTRING(PROFILES_NOTE));
// Fill in values
SetDlgItemText(IDC_HUBNAME, Text::toT(entry->getName()).c_str());
SetDlgItemText(IDC_HUBDESCR, Text::toT(entry->getDescription()).c_str());
SetDlgItemText(IDC_HUBADDR, Text::toT(entry->getServerStr()).c_str());
SetDlgItemText(IDC_NICK, Text::toT(entry->get(HubSettings::Nick)).c_str());
SetDlgItemText(IDC_HUBPASS, Text::toT(entry->getPassword()).c_str());
SetDlgItemText(IDC_USERDESC, Text::toT(entry->get(HubSettings::Description)).c_str());
SetDlgItemText(IDC_EMAIL, Text::toT(entry->get(HubSettings::Email)).c_str());
SetDlgItemText(IDC_AWAY_MSG, Text::toT(entry->get(HubSettings::AwayMsg)).c_str());
CheckDlgButton(IDC_STEALTH, entry->getStealth() ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(IDC_FAV_NO_PM, entry->getFavNoPM() ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(IDC_SHOW_JOIN, toInt(entry->get(HubSettings::ShowJoins)));
CheckDlgButton(IDC_SHOW_JOIN_FAV, toInt(entry->get(HubSettings::FavShowJoins)));
CheckDlgButton(IDC_LOGMAINCHAT, toInt(entry->get(HubSettings::LogMainChat)));
CheckDlgButton(IDC_CHAT_NOTIFY, toInt(entry->get(HubSettings::ChatNotify)));
CheckDlgButton(IDC_FAILOVER, toInt(entry->get(HubSettings::AcceptFailovers)));
CheckDlgButton(IDC_FAV_NO_PM, entry->getFavNoPM() ? BST_CHECKED : BST_UNCHECKED);
auto searchInterval = entry->get(HubSettings::SearchInterval);
CheckDlgButton(IDC_SEARCH_INTERVAL_DEFAULT, searchInterval == HubSettings::getMinInt() ? BST_CHECKED : BST_UNCHECKED);
SetDlgItemText(IDC_FAV_SEARCH_INTERVAL_BOX, Util::toStringW(searchInterval).c_str());
bool isAdcHub = entry->isAdcHub();
CComboBox combo;
combo.Attach(GetDlgItem(IDC_FAVGROUP_BOX));
combo.AddString(_T("---"));
combo.SetCurSel(0);
const FavHubGroups& favHubGroups = FavoriteManager::getInstance()->getFavHubGroups();
for(const auto& name: favHubGroups | map_keys) {
int pos = combo.AddString(Text::toT(name).c_str());
if(name == entry->getGroup())
combo.SetCurSel(pos);
}
combo.Detach();
// TODO: add more encoding into wxWidgets version, this is enough now
// FIXME: following names are Windows only!
combo.Attach(GetDlgItem(IDC_ENCODING));
combo.AddString(_T("System default"));
combo.AddString(_T("English_United Kingdom.1252"));
combo.AddString(_T("Czech_Czech Republic.1250"));
combo.AddString(_T("Russian_Russia.1251"));
combo.AddString(Text::toT(Text::utf8).c_str());
ctrlProfile.Attach(GetDlgItem(IDC_FAV_SHAREPROFILE));
appendProfiles();
hideShare = entry->getShareProfile() && entry->getShareProfile()->getToken() == SP_HIDDEN;
CheckDlgButton(IDC_HIDE_SHARE, hideShare ? BST_CHECKED : BST_UNCHECKED);
if(isAdcHub) {
combo.SetCurSel(4); // select UTF-8 for ADC hubs
combo.EnableWindow(false);
if (hideShare)
ctrlProfile.EnableWindow(false);
} else {
ctrlProfile.EnableWindow(false);
if(entry->getEncoding().empty()) {
combo.SetCurSel(0);
//.........这里部分代码省略.........
示例5:
BOOL
CCompletionPage::OnSetActive()
{
WTL::CString strText, strText2;
SetWizardButtons(PSWIZB_FINISH);
CStatic ctlStaticResult;
ctlStaticResult.Attach(GetDlgItem(IDC_BIND_RESULT));
CEdit ctlEditResult;
ctlEditResult.Attach(GetDlgItem(IDC_EDIT_BIND_SETTING));
// add bind type to list
strText2.LoadString(
(NMT_AGGREGATE == m_pWizData->m_nBindType) ? IDS_LOGDEV_TYPE_AGGREGATED_DISK :
(NMT_RAID0 == m_pWizData->m_nBindType) ? IDS_LOGDEV_TYPE_DISK_RAID0 :
(NMT_RAID1 == m_pWizData->m_nBindType) ? IDS_LOGDEV_TYPE_DISK_RAID1 :
(NMT_RAID4 == m_pWizData->m_nBindType) ? IDS_LOGDEV_TYPE_DISK_RAID4 : IDS_LOGDEV_TYPE
);
strText.FormatMessage(IDS_BNZ_COMPLETE_RESULT_TYPE_FMT, strText2);
ctlEditResult.AppendText(strText); ctlEditResult.AppendText(_T("\n"));
// add disk titles to list
strText.LoadString(IDS_BNZ_COMPLETE_RESULT_DISKS);
int i;
NBUnitDevicePtrList::iterator itr;
CNBUnitDevice *UnitDiskObject, *UnitDiskObjectFailed;
for(i = 0, itr = m_pWizData->listUnitDevicesBind.begin(); itr != m_pWizData->listUnitDevicesBind.end(); ++itr, i++)
{
UnitDiskObject = *itr;
if(m_pWizData->m_BindResult == i)
UnitDiskObjectFailed = UnitDiskObject;
if(itr != m_pWizData->listUnitDevicesBind.begin())
strText += _T(", ");
strText += UnitDiskObject->GetName();
}
ctlEditResult.AppendText(strText); ctlEditResult.AppendText(_T("\n"));
if(m_pWizData->m_BindResult == m_pWizData->m_nDiskCount)
{
// success
strText.LoadString(IDS_BNZ_COMPLETE_SUCCESS);
ctlStaticResult.SetWindowText(strText);
// size
pGetDiskSizeString(strText2, m_pWizData->m_nBindType, m_pWizData->m_nDiskCount, m_pWizData->listUnitDevicesBind);
strText.FormatMessage(IDS_BNZ_COMPLETE_RESULT_SIZE_FMT, strText2);
ctlEditResult.AppendText(strText); ctlEditResult.AppendText(_T("\n"));
}
else
{
// fail
strText.LoadString(IDS_BNZ_COMPLETE_FAIL);
ctlStaticResult.SetWindowText(strText);
if(m_pWizData->m_BindResult != 0xFFFFFFFF) // single disk error
{
strText.FormatMessage(IDS_BNZ_COMPLETE_RESULT_FAILED_ON_FMT,
UnitDiskObjectFailed->GetName());
ctlEditResult.AppendText(strText); ctlEditResult.AppendText(_T("\n"));
}
GetDescription(strText, m_pWizData->dwBindLastError);
ctlEditResult.AppendText(strText); ctlEditResult.AppendText(_T("\n"));
}
return TRUE;
}
示例6: OnInitDialog
LRESULT FavHubProperties::OnInitDialog(UINT, WPARAM, LPARAM, BOOL&)
{
// Translate dialog
SetWindowText(CTSTRING(FAVORITE_HUB_PROPERTIES));
SetDlgItemText(IDOK, CTSTRING(OK));
SetDlgItemText(IDCANCEL, CTSTRING(CANCEL));
SetDlgItemText(IDC_FH_HUB, CTSTRING(HUB));
SetDlgItemText(IDC_FH_IDENT, CTSTRING(FAVORITE_HUB_IDENTITY));
SetDlgItemText(IDC_FH_NAME, CTSTRING(HUB_NAME));
SetDlgItemText(IDC_FH_ADDRESS, CTSTRING(HUB_ADDRESS));
SetDlgItemText(IDC_FH_HUB_DESC, CTSTRING(DESCRIPTION));
SetDlgItemText(IDC_FH_NICK, CTSTRING(NICK));
SetDlgItemText(IDC_FH_PASSWORD, CTSTRING(PASSWORD));
SetDlgItemText(IDC_FH_USER_DESC, CTSTRING(DESCRIPTION));
SetDlgItemText(IDC_DEFAULT, CTSTRING(DEFAULT));
SetDlgItemText(IDC_ACTIVE, CTSTRING(SETTINGS_DIRECT));
SetDlgItemText(IDC_PASSIVE, CTSTRING(SETTINGS_FIREWALL_PASSIVE));
SetDlgItemText(IDC_STEALTH, CTSTRING(STEALTH_MODE));
SetDlgItemText(IDC_FAV_SEARCH_INTERVAL, CTSTRING(MINIMUM_SEARCH_INTERVAL));
SetDlgItemText(IDC_FAVGROUP, CTSTRING(GROUP));
// Fill in values
SetDlgItemText(IDC_HUBNAME, Text::toT(entry->getName()).c_str());
SetDlgItemText(IDC_HUBDESCR, Text::toT(entry->getDescription()).c_str());
SetDlgItemText(IDC_HUBADDR, Text::toT(entry->getServer()).c_str());
SetDlgItemText(IDC_HUBNICK, Text::toT(entry->getNick(false)).c_str());
SetDlgItemText(IDC_HUBPASS, Text::toT(entry->getPassword()).c_str());
SetDlgItemText(IDC_HUBUSERDESCR, Text::toT(entry->getUserDescription()).c_str());
CheckDlgButton(IDC_STEALTH, entry->getStealth() ? BST_CHECKED : BST_UNCHECKED);
SetDlgItemText(IDC_RAW_ONE, Text::toT(entry->getRawOne()).c_str());
SetDlgItemText(IDC_RAW_TWO, Text::toT(entry->getRawTwo()).c_str());
SetDlgItemText(IDC_RAW_THREE, Text::toT(entry->getRawThree()).c_str());
SetDlgItemText(IDC_RAW_FOUR, Text::toT(entry->getRawFour()).c_str());
SetDlgItemText(IDC_RAW_FIVE, Text::toT(entry->getRawFive()).c_str());
SetDlgItemText(IDC_SERVER, Text::toT(entry->getIP()).c_str());
SetDlgItemText(IDC_FAV_SEARCH_INTERVAL_BOX, Util::toStringW(entry->getSearchInterval()).c_str());
CComboBox combo;
combo.Attach(GetDlgItem(IDC_FAVGROUP_BOX));
combo.AddString(_T("---"));
combo.SetCurSel(0);
const FavHubGroups& favHubGroups = FavoriteManager::getInstance()->getFavHubGroups();
for(FavHubGroups::const_iterator i = favHubGroups.begin(); i != favHubGroups.end(); ++i) {
const string& name = i->first;
int pos = combo.AddString(Text::toT(name).c_str());
if(name == entry->getGroup())
combo.SetCurSel(pos);
}
combo.Detach();
// TODO: add more encoding into wxWidgets version, this is enough now
// FIXME: following names are Windows only!
combo.Attach(GetDlgItem(IDC_ENCODING));
combo.AddString(_T("System default"));
combo.AddString(_T("English_United Kingdom.1252"));
combo.AddString(_T("Czech_Czech Republic.1250"));
combo.AddString(_T("Russian_Russia.1251"));
combo.AddString(Text::toT(Text::utf8).c_str());
if(strnicmp("adc://", entry->getServer().c_str(), 6) == 0 || strnicmp("adcs://", entry->getServer().c_str(), 7) == 0)
{
combo.SetCurSel(4); // select UTF-8 for ADC hubs
combo.EnableWindow(false);
}
else
{
if(entry->getEncoding().empty())
combo.SetCurSel(0);
else
combo.SetWindowText(Text::toT(entry->getEncoding()).c_str());
}
combo.Detach();
if(entry->getMode() == 0)
CheckRadioButton(IDC_ACTIVE, IDC_DEFAULT, IDC_DEFAULT);
else if(entry->getMode() == 1)
CheckRadioButton(IDC_ACTIVE, IDC_DEFAULT, IDC_ACTIVE);
else if(entry->getMode() == 2)
CheckRadioButton(IDC_ACTIVE, IDC_DEFAULT, IDC_PASSIVE);
CEdit tmp;
tmp.Attach(GetDlgItem(IDC_HUBNAME));
tmp.SetFocus();
tmp.SetSel(0,-1);
tmp.Detach();
tmp.Attach(GetDlgItem(IDC_HUBNICK));
tmp.LimitText(35);
tmp.Detach();
tmp.Attach(GetDlgItem(IDC_HUBUSERDESCR));
tmp.LimitText(50);
tmp.Detach();
tmp.Attach(GetDlgItem(IDC_HUBPASS));
tmp.SetPasswordChar('*');
tmp.Detach();
CUpDownCtrl updown;
//.........这里部分代码省略.........