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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Restricting resizing of controlbars

Restricting resizing of controlbars

Scheduled Pinned Locked Moved C / C++ / MFC
graphics
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.
  • E Offline
    E Offline
    electronicman_x
    wrote on last edited by
    #1

    I'm currently using controlbars (stingray studio SECControlbars which are derived from CControlbar) and I'm trying to limit the size that you can reduce them to. Currently, i'm able to catch the WM_SIZE message in my SECControlbar derived class, but im not entirely able to control the actual sizing. What happens is i catch the size message and im able to see what size is requested, but when i attempt to change the size and pass to the base class, the results are incorrect. In my specific case, im trying to limit the width of a vertical controlbar to 132 or more pixels. What happens with my code is the first sizing that goes below the 132 barrier actually happens despite my efforts to stop it. When i size again (also attempting below 132) the size is adjusted towards my 132 barrier but not exactly right and depending on how small i actually tried to make it. These two results happen one after the other, so every other size appears to try and size correctly. I think im setting my size after the actual controlbar size is interpretted but i can't seem to find the message i should capture and override to prevent this. I've tried using spy++ on the window but i can't seem to find any other messages that could be responsible. I also think I could be misusing the CalcDynamicLayout() function, but i've tried most all of the options and it doesnt seem to matter all that much. Any solution for a CControlbar should work in this situation, but i haven't seen one in any examples. Here's part of my OnSize handler: void VHelpDlg::OnSize(UINT nType, int cx, int cy) { VMainFrame *pMainFrame = static_cast(AfxGetMainWnd()); if(pMainFrame) VGENyDoc* pDoc = pMainFrame->GetDocument(); else return; CSize szCtrlBar; if(this->m_szDockVert.cx<132) { this->m_szDockVert.cx=132; cx=132; szCtrlBar=CalcDynamicLayout(132,LM_COMMIT|LM_VERTDOCK|LM_STRETCH); } SECControlBar::OnSize(nType,cx,cy); Invalidate(); } Jeff Rothenberg Project Engineer Vector CANtech, Inc.

    D 1 Reply Last reply
    0
    • E electronicman_x

      I'm currently using controlbars (stingray studio SECControlbars which are derived from CControlbar) and I'm trying to limit the size that you can reduce them to. Currently, i'm able to catch the WM_SIZE message in my SECControlbar derived class, but im not entirely able to control the actual sizing. What happens is i catch the size message and im able to see what size is requested, but when i attempt to change the size and pass to the base class, the results are incorrect. In my specific case, im trying to limit the width of a vertical controlbar to 132 or more pixels. What happens with my code is the first sizing that goes below the 132 barrier actually happens despite my efforts to stop it. When i size again (also attempting below 132) the size is adjusted towards my 132 barrier but not exactly right and depending on how small i actually tried to make it. These two results happen one after the other, so every other size appears to try and size correctly. I think im setting my size after the actual controlbar size is interpretted but i can't seem to find the message i should capture and override to prevent this. I've tried using spy++ on the window but i can't seem to find any other messages that could be responsible. I also think I could be misusing the CalcDynamicLayout() function, but i've tried most all of the options and it doesnt seem to matter all that much. Any solution for a CControlbar should work in this situation, but i haven't seen one in any examples. Here's part of my OnSize handler: void VHelpDlg::OnSize(UINT nType, int cx, int cy) { VMainFrame *pMainFrame = static_cast(AfxGetMainWnd()); if(pMainFrame) VGENyDoc* pDoc = pMainFrame->GetDocument(); else return; CSize szCtrlBar; if(this->m_szDockVert.cx<132) { this->m_szDockVert.cx=132; cx=132; szCtrlBar=CalcDynamicLayout(132,LM_COMMIT|LM_VERTDOCK|LM_STRETCH); } SECControlBar::OnSize(nType,cx,cy); Invalidate(); } Jeff Rothenberg Project Engineer Vector CANtech, Inc.

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      Straight from the documentation: The framework calls this member function after the window’s size has changed. The parameters passed to your function reflect the parameters received by the framework when the message was received. If you call the base-class implementation of this function, that implementation will use the parameters originally passed with the message and not the parameters you supply to the function. You need to look at CWnd::OnGetMinMaxInfo().

      E 1 Reply Last reply
      0
      • D David Crow

        Straight from the documentation: The framework calls this member function after the window’s size has changed. The parameters passed to your function reflect the parameters received by the framework when the message was received. If you call the base-class implementation of this function, that implementation will use the parameters originally passed with the message and not the parameters you supply to the function. You need to look at CWnd::OnGetMinMaxInfo().

        E Offline
        E Offline
        electronicman_x
        wrote on last edited by
        #3

        I put a handler for WM_GETMINMAXINFO in as OnGetMinMaxInfo() but sizing the control bar never results in the program entering this code. I'm not sure if this control bar acts like a standard CWnd, the WM_SIZING message never gets called either. Perhaps this message is being handled for me at a lower level class? Jeff Rothenberg Project Engineer Vector CANtech, Inc.

        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