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. Minimum CDialog size

Minimum CDialog size

Scheduled Pinned Locked Moved C / C++ / MFC
debugginghelpquestion
5 Posts 4 Posters 3 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.
  • L Offline
    L Offline
    LittleYellowBird
    wrote on last edited by
    #1

    I've got a modeless dialog box which can be resized and I would like to set a minumum size for it, as it looks stupid if it is too small. Any ideas? I tried editing the OnSize function like this (thinking that if it worked I could check for 'cx < MINIMUM_X' and change cx if required):- void CDlg::OnSize(UINT nType, int cx, int cy) { cx = 200; cy = 300; CDialog::OnSize(nType, cx, cy); // TODO: Add your message handler code here } It didn't work, the dialog stayed the same size. And when I looked at cx and cy in the debugger their values did not change (they were 605 & 573 when it entered the function and the same when CDialog::OnSize was called). I am very confused about why they did not change :confused:. Can anyone help? Any comments welcome :). ali p

    N 1 Reply Last reply
    0
    • L LittleYellowBird

      I've got a modeless dialog box which can be resized and I would like to set a minumum size for it, as it looks stupid if it is too small. Any ideas? I tried editing the OnSize function like this (thinking that if it worked I could check for 'cx < MINIMUM_X' and change cx if required):- void CDlg::OnSize(UINT nType, int cx, int cy) { cx = 200; cy = 300; CDialog::OnSize(nType, cx, cy); // TODO: Add your message handler code here } It didn't work, the dialog stayed the same size. And when I looked at cx and cy in the debugger their values did not change (they were 605 & 573 when it entered the function and the same when CDialog::OnSize was called). I am very confused about why they did not change :confused:. Can anyone help? Any comments welcome :). ali p

      N Offline
      N Offline
      Niklas L
      wrote on last edited by
      #2

      Check out WM_GETMINMAXINFO. This will let you set min and max sizes for your dialog.

      L 1 Reply Last reply
      0
      • N Niklas L

        Check out WM_GETMINMAXINFO. This will let you set min and max sizes for your dialog.

        L Offline
        L Offline
        LittleYellowBird
        wrote on last edited by
        #3

        Thanks you for your reply. I added a message handler for WM_GETMINMAXINFO to CMainFrame and that worked fine :) . BUT i wanted to set the minimum size for a Dialog box and when I go to add a 'New Windows Mesage Event' for for the dialog box, WM_GETMINMAXINFO is not on the list :( . Any ideas? ali p

        J 1 Reply Last reply
        0
        • L LittleYellowBird

          Thanks you for your reply. I added a message handler for WM_GETMINMAXINFO to CMainFrame and that worked fine :) . BUT i wanted to set the minimum size for a Dialog box and when I go to add a 'New Windows Mesage Event' for for the dialog box, WM_GETMINMAXINFO is not on the list :( . Any ideas? ali p

          J Offline
          J Offline
          Jim A Johnson
          wrote on last edited by
          #4

          Yeah, that's a design flaw in VC++. You have to go to the last page of the class wizard - can't remember what it's called, alas, I've moved to VC7 and ClassWizard is gone - and then there's a silly little combo box labeled "class type" or something like that. Change it from "dialog" to "window" and all of the messages will be availale.

          C 1 Reply Last reply
          0
          • J Jim A Johnson

            Yeah, that's a design flaw in VC++. You have to go to the last page of the class wizard - can't remember what it's called, alas, I've moved to VC7 and ClassWizard is gone - and then there's a silly little combo box labeled "class type" or something like that. Change it from "dialog" to "window" and all of the messages will be availale.

            C Offline
            C Offline
            CMFC6 0VS NETUser
            wrote on last edited by
            #5

            Jim A. Johnson wrote: I've moved to VC7 and ClassWizard is gone Ya, I looked for ever to find where to enter in OnPaint() handler for My dialog class. I would have added a menu for a Message handler dialog box when you right click the Class in the solution explorer like VC++6.0 had like the Project(I can't rememeber what the tab name is) window. Real World Coding:      POP& BuyAPop(Money ADollar){...};

            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