Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. CToolBar Flickers

CToolBar Flickers

Scheduled Pinned Locked Moved C / C++ / MFC
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    janaswamy uday
    wrote on last edited by
    #1

    Hi All, I am getting Flicker for Toolbar which is Owner Drawn. I am creating a SplitterWnd which has a Form View in Right Side Pane and TreeView in Leftside Pane. There is no flicer in FormView but when i am trying to Disable the Icons in CToolbar for some Condition it is some times Continuosly Flickers i could not understand why this happens. Code ---- void CMainFrame::OnUpdateFileDeleteplans(CCmdUI* pCmdUI) { bool bExecuteSQLWin = false; if(bExecuteSQLWin) pCmdUI->Enable(FALSE); else pCmdUI->Enable(); pCmdUI->Enable(CheckOpenPlans()); --> Here i added with a Function CheckOpenPlans().......>==========// } bool CMainFrame::CheckOpenPlans() { CMDIChildWnd* MyWnd = NULL; MyWnd = MDIGetActive(); CView* pView = NULL; if(MyWnd != NULL) { pView = (CView*) MyWnd->GetActiveView(); if((pView->IsKindOf(RUNTIME_CLASS(CSelectQueryView)) || pView->IsKindOf(RUNTIME_CLASS(OpenPlansTreeView)))) return false; else return true; } return true; }

    R 1 Reply Last reply
    0
    • J janaswamy uday

      Hi All, I am getting Flicker for Toolbar which is Owner Drawn. I am creating a SplitterWnd which has a Form View in Right Side Pane and TreeView in Leftside Pane. There is no flicer in FormView but when i am trying to Disable the Icons in CToolbar for some Condition it is some times Continuosly Flickers i could not understand why this happens. Code ---- void CMainFrame::OnUpdateFileDeleteplans(CCmdUI* pCmdUI) { bool bExecuteSQLWin = false; if(bExecuteSQLWin) pCmdUI->Enable(FALSE); else pCmdUI->Enable(); pCmdUI->Enable(CheckOpenPlans()); --> Here i added with a Function CheckOpenPlans().......>==========// } bool CMainFrame::CheckOpenPlans() { CMDIChildWnd* MyWnd = NULL; MyWnd = MDIGetActive(); CView* pView = NULL; if(MyWnd != NULL) { pView = (CView*) MyWnd->GetActiveView(); if((pView->IsKindOf(RUNTIME_CLASS(CSelectQueryView)) || pView->IsKindOf(RUNTIME_CLASS(OpenPlansTreeView)))) return false; else return true; } return true; }

      R Offline
      R Offline
      Roger Allen
      wrote on last edited by
      #2

      The OnUpdateToolbarButton() functions will be called automatically by the MFC rotuing during the OnIdle action of your application. The flicker is probbaly caused by you changing the state of the button(s) multiple times in the same update call. Try and make sure you only have a single call to Enable(). Assign the desired state to a local variable, compute any required changes in the variable and then call pCmdUI->Enable(variable). By the looks of it you may well be getting a call to Enable with false and true sequentially.

      If you vote me down, my score will only get lower

      J 1 Reply Last reply
      0
      • R Roger Allen

        The OnUpdateToolbarButton() functions will be called automatically by the MFC rotuing during the OnIdle action of your application. The flicker is probbaly caused by you changing the state of the button(s) multiple times in the same update call. Try and make sure you only have a single call to Enable(). Assign the desired state to a local variable, compute any required changes in the variable and then call pCmdUI->Enable(variable). By the looks of it you may well be getting a call to Enable with false and true sequentially.

        If you vote me down, my score will only get lower

        J Offline
        J Offline
        janaswamy uday
        wrote on last edited by
        #3

        Hi Roger, Thank You Very Much for giving me a solution. Thanks & Regards, Uday.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups