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. CEdit & CDialog

CEdit & CDialog

Scheduled Pinned Locked Moved C / C++ / MFC
questionhelp
6 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.
  • G Offline
    G Offline
    gas
    wrote on last edited by
    #1

    Hi all, how can i resize my CEdit, (with GetRect & MoveWindow) automatically, when the Main CDialog will be resized?????? On the Main CDialog i want to scale the CEdit to 0,0 cause i dont want a thick border =p ___ How can i manage this?? Please help me!! Thanx and bye b4ckup :confused:

    M 1 Reply Last reply
    0
    • G gas

      Hi all, how can i resize my CEdit, (with GetRect & MoveWindow) automatically, when the Main CDialog will be resized?????? On the Main CDialog i want to scale the CEdit to 0,0 cause i dont want a thick border =p ___ How can i manage this?? Please help me!! Thanx and bye b4ckup :confused:

      M Offline
      M Offline
      Masoud Samimi
      wrote on last edited by
      #2

      Maybe I could help, but I can't clearly understand your need? :) Post some code lines here! "Socrates is a man. All men are mortal. Therefore Socrates is mortal." -- Aristotle (syllogism) Cheers Masoud SamimiGo!

      G 1 Reply Last reply
      0
      • M Masoud Samimi

        Maybe I could help, but I can't clearly understand your need? :) Post some code lines here! "Socrates is a man. All men are mortal. Therefore Socrates is mortal." -- Aristotle (syllogism) Cheers Masoud SamimiGo!

        G Offline
        G Offline
        gas
        wrote on last edited by
        #3

        aehm ;) k .. I have a little dialog based prog with an edit control in there. the edit control should turn up on the upper left @ x = 0 and y = 0, without a border =p _____ ok???? and: when i resize the dialog, the edit control should also resize. here´s what i think (i know that dont works): BOOL CMp3insDlg::OnInitDialog() { CDialog::OnInitDialog(); CRect rect; CEdit* ce = (CEdit*)GetDlgItem(IDC_EDIT); ce->GetWindowRect(&rect); ce->MoveWindow(&rect); return TRUE; } when i throw the code into: void CMp3insDlg::OnSize(UINT nType, int cx, int cy) { CDialog::OnSize(nType, cx, cy); } my programm crashes!! yeah, i know i´m stupid, please help me ;) (if you wish i can send you an email with a screenshot from an other programm, where you can see what i mean) thanX

        M 1 Reply Last reply
        0
        • G gas

          aehm ;) k .. I have a little dialog based prog with an edit control in there. the edit control should turn up on the upper left @ x = 0 and y = 0, without a border =p _____ ok???? and: when i resize the dialog, the edit control should also resize. here´s what i think (i know that dont works): BOOL CMp3insDlg::OnInitDialog() { CDialog::OnInitDialog(); CRect rect; CEdit* ce = (CEdit*)GetDlgItem(IDC_EDIT); ce->GetWindowRect(&rect); ce->MoveWindow(&rect); return TRUE; } when i throw the code into: void CMp3insDlg::OnSize(UINT nType, int cx, int cy) { CDialog::OnSize(nType, cx, cy); } my programm crashes!! yeah, i know i´m stupid, please help me ;) (if you wish i can send you an email with a screenshot from an other programm, where you can see what i mean) thanX

          M Offline
          M Offline
          Masoud Samimi
          wrote on last edited by
          #4

          Hi! :) I tried this last night and it worked:

          void CSizeEditDlg::OnSize(UINT nType, int cx, int cy)
          {
          CDialog::OnSize(nType, cx, cy);

          CEdit\* ce = (CEdit\*)GetDlgItem(IDC\_EDIT1); 
          ::MoveWindow(ce->GetSafeHwnd(), 50 , 50, 200, 65 ,TRUE); 
          
          // However, you must get the size of your dlg rect and do some calcs
          // to move the window according to the sizing value of dlg!
          
          
          // Just some extra test/show how you can get/use the m\_Hwnd to be safe! :)
          
          ::SetWindowText(ce->GetSafeHwnd(),"Hi There! I am being resized! :-)");
          

          }

          The above works fine, but better yet I suggest you use the CResizableDialog by Paolo Messina here on CP! Its here: http://www.codeproject.com/dialog/resizabledialog.asp It is realy Nice! :-D Good Luck! "Socrates is a man. All men are mortal. Therefore Socrates is mortal." -- Aristotle (syllogism) Cheers Masoud Samimi Go!

          G 1 Reply Last reply
          0
          • M Masoud Samimi

            Hi! :) I tried this last night and it worked:

            void CSizeEditDlg::OnSize(UINT nType, int cx, int cy)
            {
            CDialog::OnSize(nType, cx, cy);

            CEdit\* ce = (CEdit\*)GetDlgItem(IDC\_EDIT1); 
            ::MoveWindow(ce->GetSafeHwnd(), 50 , 50, 200, 65 ,TRUE); 
            
            // However, you must get the size of your dlg rect and do some calcs
            // to move the window according to the sizing value of dlg!
            
            
            // Just some extra test/show how you can get/use the m\_Hwnd to be safe! :)
            
            ::SetWindowText(ce->GetSafeHwnd(),"Hi There! I am being resized! :-)");
            

            }

            The above works fine, but better yet I suggest you use the CResizableDialog by Paolo Messina here on CP! Its here: http://www.codeproject.com/dialog/resizabledialog.asp It is realy Nice! :-D Good Luck! "Socrates is a man. All men are mortal. Therefore Socrates is mortal." -- Aristotle (syllogism) Cheers Masoud Samimi Go!

            G Offline
            G Offline
            gas
            wrote on last edited by
            #5

            hey! Many thanx .. the CResizableDialog works very fine ;p that´s what i want!! .. and thanx for your fast help!! ------------------------------------------------------------------------------- ok here´s how i made it: void CMyDlg::OnSize(UINT nType, int cx, int cy) { CResizableDialog::OnSize(nType, cx, cy); CRect rect; CEdit* ce = (CEdit*)GetDlgItem(IDC_EDIT); ce->GetWindowRect(&rect); ::MoveWindow(ce->GetSafeHwnd(), 0, 0, rect.right, rect.bottom, TRUE); //hehe rect.right and rect.bottom .. that´s all ;) } bye b4ckup (:

            M 1 Reply Last reply
            0
            • G gas

              hey! Many thanx .. the CResizableDialog works very fine ;p that´s what i want!! .. and thanx for your fast help!! ------------------------------------------------------------------------------- ok here´s how i made it: void CMyDlg::OnSize(UINT nType, int cx, int cy) { CResizableDialog::OnSize(nType, cx, cy); CRect rect; CEdit* ce = (CEdit*)GetDlgItem(IDC_EDIT); ce->GetWindowRect(&rect); ::MoveWindow(ce->GetSafeHwnd(), 0, 0, rect.right, rect.bottom, TRUE); //hehe rect.right and rect.bottom .. that´s all ;) } bye b4ckup (:

              M Offline
              M Offline
              Masoud Samimi
              wrote on last edited by
              #6

              Thankx to you as well! My pleasure! ;-D Programming is fun! Especially when things work! Enjoy! :-D "Socrates is a man. All men are mortal. Therefore Socrates is mortal." -- Aristotle (syllogism) Cheers Masoud Samimi Go!

              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