Exemplo n.º 1
0
void CStockBuyUI::OnItemActive(TNotifyUI& msg)
{
	if (OrderList != m_iCurList)
	{
		return;
	}

	int iSelect = m_pStockOrderList->GetCurSel();
	CListTextElementUI *pNewElem = new CListTextElementUI;
	CListTextElementUI *pOldElem = static_cast<CListTextElementUI* >(m_pStockOrderList->GetItemAt(iSelect));

	m_pStockOrderList->RemoveAt(iSelect);
	
	pNewElem->SetTag(m_pStockOrderList->GetCount());
	m_pStockOrderList->AddAt(pNewElem, 0);	
	CDuiString strTime = Base::CTimeKit::GetCurDateTime(TIME_FORMAT);
	
	pNewElem->SetText(0, pOldElem->GetText(0));
	pNewElem->SetText(1, pOldElem->GetText(1));	
	pNewElem->SetText(2, pOldElem->GetText(2));
	pNewElem->SetText(3, pOldElem->GetText(3));
	pNewElem->SetText(4, pOldElem->GetText(4));
	pNewElem->SetText(5, _T(""));	
	pNewElem->SetText(6, _T("撤单"));
	pNewElem->SetText(7, strTime.Mid(0, 6));
	pNewElem->SetText(8, strTime.Mid(6,-1));
	pNewElem->SetText(9, _T("123456789"));
	pNewElem->SetText(10, pOldElem->GetText(10));
	
	//send to sdk
	//::PostMessage(GetHWND(), WM_USER_STOCK_ORDER_REQ, (WPARAM)pNewElem, 0L);
	
	OnOrderReq(GetHWND(), (WPARAM)(pNewElem), (LPARAM)(OrderBuy));
}
Exemplo n.º 2
0
void CFrameWnd::InitWindow()
{
//    SetIcon(IDR_MAINFRAME); // 设置任务栏图标
    CenterWindow();

    // 初始化CActiveXUI控件
    CActiveXUI* pActiveXUI = static_cast<CActiveXUI*>(m_PaintManager.FindControl(_T("ActiveXDemo1")));

    if( pActiveXUI ) 
    {
        IWebBrowser2* pWebBrowser = NULL;

        pActiveXUI->SetDelayCreate(false);              // 相当于界面设计器里的DelayCreate属性改为FALSE,在duilib自带的FlashDemo里可以看到此属性为TRUE             
        pActiveXUI->CreateControl(CLSID_WebBrowser);    // 相当于界面设计器里的Clsid属性里填入{8856F961-340A-11D0-A96B-00C04FD705A2},建议用CLSID_WebBrowser,如果想看相应的值,请见<ExDisp.h>
        pActiveXUI->GetControl(IID_IWebBrowser2, (void**)&pWebBrowser);

        if( pWebBrowser != NULL ) 
        {
            //pWebBrowser->Navigate(L"https://code.google.com/p/duilib/",NULL,NULL,NULL,NULL);  
			pWebBrowser->Navigate(L"about:blank", NULL, NULL, NULL, NULL);  
			pWebBrowser->Navigate(L"http://www.baidu.com/", NULL, NULL, NULL, NULL);  // 由于谷歌时不时被墙,所以换成反应快的网站
            pWebBrowser->Release();
			
        }
    }

    // 初始化CProgressUI控件
    CProgressUI* pProgress = static_cast<CProgressUI*>(m_PaintManager.FindControl(_T("ProgressDemo1")));    
    pProgress->SetValue(50);

    // 初始化CListUI控件
    CDuiString str;
    CListUI* pList = static_cast<CListUI*>(m_PaintManager.FindControl(_T("ListDemo1")));

    for (int i = 0; i < 100; i++)
    {
        CListTextElementUI* pListElement = new CListTextElementUI;
        pListElement->SetTag(i);
        pList->Add(pListElement);

        str.Format(_T("%d"), i);
        pListElement->SetText(0, str);
        pListElement->SetText(1, _T("haha"));
    }
}
Exemplo n.º 3
0
    static DWORD WINAPI Search(LPVOID lpParameter)
    {
        try
        {
            struct Prama* prama = (struct Prama *)lpParameter;
            CListUI* pList = prama->pList;
            CButtonUI* pSearch = prama->pSearch;
            CStdString tDomain = prama->tDomain;
            //-------------------------------------
            /*
            * 添加数据循环
            */
            for(int i=0; i<100; i++)
            {
                std::stringstream ss;
                ss << "www." << i << ".com";
                domain.push_back(ss.str());
                ss.clear();
                ss << "it's " << i;
                desc.push_back(ss.str());
                CListTextElementUI* pListElement = new CListTextElementUI;
                pListElement->SetTag(i);
                if (pListElement != NULL)
                {
                    ::PostMessage(prama->hWnd, WM_ADDLISTITEM, 0L, (LPARAM)pListElement);
                }
                /*
                *	Sleep 为了展示添加的动态效果,故放慢了添加速度,同时可以看到添加过程中界面仍然可以响应
                */
                ::Sleep(100);
            }
            //------------------------------------------
            delete prama;

            pSearch->SetEnabled(true);
            return 0;
        }
        catch(...)
        {
            return 0;
        }
    }
Exemplo n.º 4
0
bool ConnInfoUI::LoadConfig( const std::string& path )
{
    m_pListUI->RemoveAll();
    /// 设置利用回调填充数据
    m_pListUI->SetTextCallback(this);//[1]
    m_dicServerInfo.clear();
    
    FILE* fp = fopen(kConfigFilePath, "r");
    if (!fp) return false;

    FileStream is(fp);
    Document document;    /// Default template parameter uses UTF8 and MemoryPoolAllocator.
    if (document.ParseStream<0>(is).HasParseError())
    {
        UserMessageBox(GetHWND(), 10014, Base::CharacterSet::ANSIToUnicode(document.GetParseError()).c_str(), MB_ICONERROR);
        fclose(fp);
        return false;
    }

    const Value& serverConfig = document["Server"];
    int idx = 0;
    for (Value::ConstValueIterator itr = serverConfig.Begin(); itr != serverConfig.End(); ++itr)
    {
        const Value& subConfig = *itr;
        CDuiString name = Base::CharacterSet::UTF8ToUnicode(subConfig["name"].GetString()).c_str();
        m_dicServerInfo[kServerNameIndex].push_back(Base::CharacterSet::UnicodeToANSI(name.GetData()));
        m_dicServerInfo[kServerIpIndex].push_back(subConfig["ip"].GetString());
        std::ostringstream os;
        os<<subConfig["port"].GetInt();
        m_dicServerInfo[kServerPortIndex].push_back(os.str());
        m_dicServerInfo[kServerAuthIndex].push_back(subConfig["auth"].GetString());

        CListTextElementUI* pListElement = new CListTextElementUI;
        pListElement->SetTag(idx++);
        /// 设置工具提示
        pListElement->SetToolTip(m_pListUI->GetToolTip());
        m_pListUI->Add(pListElement);
    }
    fclose(fp);

    return true;
}