MCPcopy Create free account
hub / github.com/SOUI2/soui / OnCommand

Method OnCommand

demo/MainDlg.cpp:492–539  ·  view source on GitHub ↗

演示如何响应菜单事件

Source from the content-addressed store, hash-verified

490
491//演示如何响应菜单事件
492void CMainDlg::OnCommand( UINT uNotifyCode, int nID, HWND wndCtl )
493{
494 if(uNotifyCode==0)
495 {
496 if(nID == 7)
497 {
498 if(GetColorizeColor()==0) DoColorize(RGB(255,255,0));//将图片调整为粉红
499 else DoColorize(0);//恢复
500 }
501 else if(nID==6)
502 {//nID==6对应menu_test定义的菜单的exit项。
503 PostMessage(WM_CLOSE);
504 }else if(nID==54)
505 {//about SOUI
506 STabCtrl *pTabCtrl = FindChildByName2<STabCtrl>(L"tab_main");
507 if(pTabCtrl) pTabCtrl->SetCurSel(_T("about"));
508 }
509 else if (nID == 51)
510 {//skin1
511 SSkinLoader::getSingleton().LoadSkin(_T("themes\\skin1"));
512 SWindow::Invalidate();
513 }
514 else if (nID == 52)
515 {//skin2
516 SSkinLoader::getSingleton().LoadSkin(_T("themes\\skin2"));
517 SWindow::Invalidate();
518 }
519 else if (nID == 53)
520 {//skin3
521 SSkinLoader::getSingleton().LoadSkin(_T("themes\\skin3"));
522 SWindow::Invalidate();
523 }
524
525 else if(nID==100)
526 {//delete item in mclistview
527 SMCListView *pListView = FindChildByName2<SMCListView>(L"mclv_test");
528 if(pListView)
529 {
530 int iItem = pListView->GetSel();
531 if(iItem!=-1)
532 {
533 CTestMcAdapterFix *pAdapter = (CTestMcAdapterFix*)pListView->GetAdapter();
534 pAdapter->DeleteItem(iItem);
535 }
536 }
537 }
538 }
539}
540
541
542void CMainDlg::OnBtnHideTest()

Callers

nothing calls this directly

Calls 5

PostMessageFunction · 0.85
InvalidateFunction · 0.85
SetCurSelMethod · 0.45
LoadSkinMethod · 0.45
DeleteItemMethod · 0.45

Tested by

no test coverage detected