Hide

SftBox/OCX 5.0 - Combo Box Control

Display
Print

Speed Sample (C++)

This sample demonstrates the control's performance.

The source code is located at C:\Program Files (x86)\Softelvdm\SftBox OCX 5.0\Samples\VC++\Speed\SpeedDlg.cpp or C:\Program Files\Softelvdm\SftBox OCX 5.0\Samples\VC++\Speed\SpeedDlg.cpp (on 32-bit Windows versions).

BOOL CSpeedDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon

    m_ItemTotal = 0;

    ISftBoxPtr vCombo = m_Combo1.GetControlUnknown();
    vCombo->PutFont(NULL);
    vCombo->Headers->PutFont(NULL);
    vCombo->Edit->PutFont(NULL);

	return TRUE;  // return TRUE  unless you set the focus to a control
}

void CSpeedDlg::AddItems(long count)
{
    CWaitCursor wt;

    ISftBoxPtr vCombo = m_Combo1.GetControlUnknown();

    ISftBoxItemsPtr pItems = vCombo->Items;
    long index;
    TCHAR szBuffer[512];

    vCombo->BulkUpdate = TRUE;
    if (m_ItemTotal > 0)
        pItems->Selection = 0;
    for (long i = 0 ; i < count ; ++i) {
        wsprintf(szBuffer, _T("Item %d"), m_ItemTotal++);
        index = pItems->Add(szBuffer);
    }
    pItems->Selection = index;
    vCombo->BulkUpdate = FALSE;

    pItems->RecalcHorizontalExtent(100);
    pItems->HorizontalExtent += 30;
}

void CSpeedDlg::OnAdd100()
{
	AddItems(100);
}

void CSpeedDlg::OnAdd1000()
{
	AddItems(1000);
}

void CSpeedDlg::OnAdd5000()
{
	AddItems(5000);
}

void CSpeedDlg::OnAdd10000()
{
	AddItems(10000);
}

void CSpeedDlg::OnAdd20000()
{
	AddItems(20000);
}

void CSpeedDlg::OnClear()
{
    CWaitCursor wt;

    ISftBoxPtr vCombo = m_Combo1.GetControlUnknown();

    ISftBoxItemsPtr pItems = vCombo->Items;
    pItems->Clear();

    m_ItemTotal = 0;
}

Last Updated 08/13/2020 - (email)
© 2024 Softel vdm, Inc.