zoukankan      html  css  js  c++  java
  • WM_IDLEUPDATECMDUI与CView

    CFrameWnd貌似会向其CView子窗口(从CWnd继承的子窗口也适用)发生此消息, 子窗口可以响应该消息来更新一些按钮控件的状态. ex:

    #pragma once
    // CWelcomeView

    class CWelcomeWnd : public CWnd
    {
    public:
        CWelcomeWnd();
        virtual ~CWelcomeWnd();

    protected:
        DECLARE_MESSAGE_MAP()

        afx_msg  void OnIdleUpdateCmdUI();  

    };

    // WelcomeView.cpp : 实现文件
    //

    #include "stdafx.h"
    #include "WelcomeView.h"
    #include "afxpriv.h"

    #ifdef _DEBUG
    #define new DEBUG_NEW
    #undef THIS_FILE
    static char THIS_FILE[] = __FILE__;
    #endif

    // CWelcomeView

    CWelcomeView::CWelcomeView()
    {

    }

    CWelcomeView::~CWelcomeView()
    {
    }

    BEGIN_MESSAGE_MAP(CWelcomeView, CWnd)
        ON_MESSAGE_VOID(WM_IDLEUPDATECMDUI, OnIdleUpdateCmdUI)
    END_MESSAGE_MAP()

    // CWelcomeView 消息处理程序

    afx_msg void CWelcomeView::OnIdleUpdateCmdUI()
    {
        BOOL bEnabled = FALSE;

        // 树形控件弹出菜单

        // 导入导出
        bEnabled = (m_nCurrTag == TAG_SIM1 ||
                    m_nCurrTag == TAG_SIM2 ||
                    m_nCurrTag == TAG_ME);
        m_wndDropBtnImpExp.EnableCommand(IDC_IMPEXP,    bEnabled);
        m_wndDropBtnImpExp.EnableCommand(IDC_IMPCSV,    bEnabled);
        m_wndDropBtnImpExp.EnableCommand(IDC_IMPVCARD,    bEnabled);
        m_wndDropBtnImpExp.EnableCommand(IDC_EXPCSV,    bEnabled);
        m_wndDropBtnImpExp.EnableCommand(IDC_EXPVCARD,    bEnabled);

        // 复制粘贴
        bEnabled = (m_nCurrTag == TAG_SIM1 ||
                    m_nCurrTag == TAG_SIM2 ||
                    m_nCurrTag == TAG_ME   ||
                    m_nCurrTag == TAG_LOCAL);
        bEnabled &= (m_wndPbList.GetSelectedCount() > 0);
        m_wndDropBtnCopySave.EnableCommand(IDC_COPY1, bEnabled);
        m_wndDropBtnCopySave.EnableCommand(IDC_CUT1, bEnabled);

        bEnabled = (m_nCurrTag == TAG_SIM1 ||
            m_nCurrTag == TAG_SIM2 ||
            m_nCurrTag == TAG_ME   ||
            m_nCurrTag == TAG_LOCAL);
        bEnabled &= (m_clipboard.size() > 0);
        m_wndDropBtnCopySave.EnableCommand(IDC_PASTE1, bEnabled);

        // 删除
        bEnabled = (m_wndPbList.GetSelectedCount() > 0);
        m_wndBtnDelete.EnableWindow(bEnabled);

        // 同步
        bEnabled = (m_nCurrTag == TAG_SIM1 ||
            m_nCurrTag == TAG_SIM2 ||
            m_nCurrTag == TAG_ME);
        m_wndBtnSync.EnableWindow(bEnabled);

        // 刷新
        //bEnabled = (m_nCurrTag == TAG_SIM1 ||
        //    m_nCurrTag == TAG_SIM2 ||
        //    m_nCurrTag == TAG_ME);

        // 添加
        bEnabled = (m_nCurrTag == TAG_SIM1 ||
            m_nCurrTag == TAG_SIM2 ||
            m_nCurrTag == TAG_ME);
        m_wndPbList.EnableTopButton(TOP_COMMAND_ADD, bEnabled);

    }

  • 相关阅读:
    linux TCP数据包重传过程----小结
    linux TCP头部的构造的简单分析
    CentOS 7镜像下载
    JAVAEE——BOS物流项目03:学习计划、messager、menubutton、登陆拦截器、信息校验和取派员添加功能
    JAVAEE——BOS物流项目02:学习计划、动态添加选项卡、ztree、项目底层代码构建
    JAVAEE——BOS物流项目01:学习计划、搭建环境、主页设计(jQuery EasyUI)
    Maven02——回顾、整合ssh框架、分模块开发、私服
    巧妙取法——最小公倍数
    深度优先搜索——地宫取宝
    Maven01——简介、安装配置、入门程序、项目构建和依赖管理
  • 原文地址:https://www.cnblogs.com/hcfalan/p/1886721.html
Copyright © 2011-2022 走看看