SftTree/DLL 7.5 - Tree Control
SftBox/OCX 5.0 - Combo Box Control
SftButton/OCX 3.0 - Button Control
SftMask/OCX 7.0 - Masked Edit Control
SftTabs/OCX 6.5 - Tab Control (VB6 only)
SftTree/OCX 7.5 - Tree Control
SftPrintPreview/DLL 2.0 - Print Preview Control (discontinued)
SftTree/DLL 7.5 - Tree Control
SftBox/OCX 5.0 - Combo Box Control
SftButton/OCX 3.0 - Button Control
SftDirectory 3.5 - File/Folder Control (discontinued)
SftMask/OCX 7.0 - Masked Edit Control
SftOptions 1.0 - Registry/INI Control (discontinued)
SftPrintPreview/OCX 1.0 - Print Preview Control (discontinued)
SftTabs/OCX 6.5 - Tab Control (VB6 only)
SftTree/OCX 7.5 - Tree Control
SftTabs/NET 6.0 - Tab Control (discontinued)
SftTree/NET 2.0 - Tree Control
This sample illustrates autocomplete.
This is not an executable sample, so a complete project is not provided. These statements are intended to show basic concepts and the syntax used.
BOOL CProject1Dlg::OnInitDialog()
{
CDialog::OnInitDialog();
m_pMask1 = m_Mask1.GetControlUnknown();
_ASSERT(m_pMask1 != NULL);
ISftMaskAutoCompletePtr pAutoComplete;
ISftMaskCaptionPtr pCaption;
pAutoComplete = m_pMask1->AutoComplete;
pCaption = m_pMask1->Caption;
pCaption->SizePercent = 33;
pCaption->Text = _T("&ZIP Code:");
m_pMask1->Mask = _T("#####");
m_pMask1->EntrySelect = entrySftMaskSelectEndHome;
pAutoComplete->File = _T("-\\Softelvdm\\AutoComplete\\SampleFile2.Suggest");
pAutoComplete->Encrypt = VARIANT_FALSE;
pAutoComplete->IgnoreCase = VARIANT_TRUE;
pAutoComplete->MaxEntries = 50;
pAutoComplete->Mode = autocompleteSftMaskSuggest;
return TRUE;
}
void CProject1Dlg::OnMatchAddCustomItemsSftMask1(long Count)
{
// Ready to add custom items
m_pMask1->AutoComplete->AddTop(_T("ZIP-Code Lookup ..."), 1);
m_pMask1->AutoComplete->AddTop(_T("State Lookup ..."), 2);
if (Count > 6) {
m_pMask1->AutoComplete->AddBottom(_T("ZIP-Code Lookup ..."), 2);
m_pMask1->AutoComplete->AddBottom(_T("State Lookup ..."), 2);
}
}
void CProject1Dlg::OnMatchCustomSftMask1(LPCTSTR Text, LPCTSTR EntryText, short EntryType)
{
if (EntryType == 1) {
m_pMask1->Rollup();
AfxMessageBox(_T("We could be looking up ZIP codes in another application..."), MB_OK, 0);
m_pMask1->Text = _T("12345");
}
if (EntryType == 2) {
m_pMask1->Rollup();
AfxMessageBox(_T("We could be looking up states in another application..."), MB_OK, 0);
m_pMask1->AutoComplete->Refresh();
}
}
void CProject1Dlg::OnMatchingSftMask1(LPCTSTR Text, BSTR FAR* EntryText, BOOL FAR* Accept)
{
if (*EntryText[0] == L'0') {
//' don't show any ZIP code starting with a "0"
*Accept = VARIANT_FALSE;
}
}
BEGIN_EVENTSINK_MAP(CProject1Dlg, CDialog)
//{{AFX_EVENTSINK_MAP(CProject1Dlg)
ON_EVENT(CProject1Dlg, IDC_SFTMASK1, 33 /* MatchAddCustomItems */, OnMatchAddCustomItemsSftMask1, VTS_I4)
ON_EVENT(CProject1Dlg, IDC_SFTMASK1, 34 /* MatchCustom */, OnMatchCustomSftMask1, VTS_BSTR VTS_BSTR VTS_I2)
ON_EVENT(CProject1Dlg, IDC_SFTMASK1, 35 /* Matching */, OnMatchingSftMask1, VTS_BSTR VTS_PBSTR VTS_PBOOL)
//}}AFX_EVENTSINK_MAP
END_EVENTSINK_MAP()
