策略为王源代码系列-股票范围选择对话框CDialog(SetGroupDlg.cpp)

Published

D:\stock\TskingVS2019\src\Client\StkUI\Dialog\SetGroupDlg.cpp

Step 1:初始化股票范围选择框。

如智能选股。加入股票类型,板块、分组三部分可选择

//初始化股票范围选择框。如智能选股。根据参数可以:股票类型,板块、分组三部分可选择。
int CDomainComboBox::InitStrings( BOOL bHasClass, BOOL bHasDomain, CDomainContainer & groups )
{
	ResetContent( );

	CDomainContainer & domains = AfxGetDomainContainer( );
	CStockContainer & container = AfxGetStockContainer();

	int	nItemCount	=	groups.GetSize();
	if( bHasClass )		nItemCount	+=	8;
	if( bHasDomain )	nItemCount	+=	domains.GetSize();
	
	// Init Storage
	InitStorage( nItemCount, 32 );
	CString	strGroup;

	if( bHasClass )
	{
		strGroup.LoadString( IDS_DOMAIN_ALL );
		int nItem = AddString( strGroup );
		SetItemData( nItem, CStockContainer::typeAll );

		strGroup.LoadString( IDS_DOMAIN_INDEX );
		nItem = AddString( strGroup );
		SetItemData( nItem, CStockContainer::typeIndex );
		
		strGroup.LoadString( IDS_DOMAIN_CLASSSHAA );
		nItem = AddString( strGroup );
		SetItemData( nItem, CStockContainer::typeClassShaa );

		strGroup.LoadString( IDS_DOMAIN_CLASSSHAB );
		nItem = AddString( strGroup );
		SetItemData( nItem, CStockContainer::typeClassShab );

		strGroup.LoadString( IDS_DOMAIN_CLASSSZNA );
		nItem = AddString( strGroup );
		SetItemData( nItem, CStockContainer::typeClassSzna );

		strGroup.LoadString( IDS_DOMAIN_CLASSSZNB );
		nItem = AddString( strGroup );
		SetItemData( nItem, CStockContainer::typeClassSznb );

		strGroup.LoadString( IDS_DOMAIN_CLASSSHABOND );
		nItem = AddString( strGroup );
		SetItemData( nItem, CStockContainer::typeClassShabond );

		strGroup.LoadString( IDS_DOMAIN_CLASSSZNBOND );
		nItem = AddString( strGroup );
		SetItemData( nItem, CStockContainer::typeClassSznbond );

		//custom extend by freeman
		strGroup.LoadString(IDS_DOMAIN_CLASSSMALL);
		nItem = AddString(strGroup);
		SetItemData(nItem, CStockContainer::typeClassSmall);



		
	}

	// Domains
	if( bHasDomain )
	{
		for( int i=0; i<domains.GetSize(); i++ )
		{
			CDomain	& domain = domains.ElementAt(i);
			int nItem = AddString( domain.m_strName );
			SetItemData( nItem, CStockContainer::typeDomain );
		}
	}

	// Groups
	for( int i=0; i<groups.GetSize(); i++ )
	{
		CDomain	& domain = groups.ElementAt(i);
		int nItem = AddString( domain.m_strName );
		SetItemData( nItem, CStockContainer::typeGroup );
	}

	return nItemCount;
}