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. need help changing Modal dialog

need help changing Modal dialog

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
5 Posts 3 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.
  • I Offline
    I Offline
    IGeorgeI
    wrote on last edited by
    #1

    I want to create a Modal Dialog and be in control of it's position in the app. Or even be able to dynamically change it's position. Is this posible? George W Software Developer www.zsystems.ca

    P 1 Reply Last reply
    0
    • I IGeorgeI

      I want to create a Modal Dialog and be in control of it's position in the app. Or even be able to dynamically change it's position. Is this posible? George W Software Developer www.zsystems.ca

      P Offline
      P Offline
      Paul M Watt
      wrote on last edited by
      #2

      You can do that in two ways, the easy way is to have your dialog call your app and allow your app to determine if it needs to move your dialog. The hard way may be a lot of work, but if this solution does not work, let me know and I will explain the other method. Good Luck


      Build a man a fire, and he will be warm for a day
      Light a man on fire, and he will be warm for the rest of his life!

      D 1 Reply Last reply
      0
      • P Paul M Watt

        You can do that in two ways, the easy way is to have your dialog call your app and allow your app to determine if it needs to move your dialog. The hard way may be a lot of work, but if this solution does not work, let me know and I will explain the other method. Good Luck


        Build a man a fire, and he will be warm for a day
        Light a man on fire, and he will be warm for the rest of his life!

        D Offline
        D Offline
        devvvy
        wrote on last edited by
        #3

        hi, just wondering, dlg.SetWindowPos() can u jsut call SetWindowPos in response to event - say OnTimer - to adjust the dialog position? i can imagine a situation in which u create a modal/modeless dlg and u wish the dialog to stay within the boundary of its view. in this scenario, do u need to create your own event - for the dialog class? how can u implement this? how can u check that the child dialog is out of place (out-of-predefined boundary) and the fire an even and thru message map i suppose we can handle the situation appropriately?? thanks! norm

        I 1 Reply Last reply
        0
        • D devvvy

          hi, just wondering, dlg.SetWindowPos() can u jsut call SetWindowPos in response to event - say OnTimer - to adjust the dialog position? i can imagine a situation in which u create a modal/modeless dlg and u wish the dialog to stay within the boundary of its view. in this scenario, do u need to create your own event - for the dialog class? how can u implement this? how can u check that the child dialog is out of place (out-of-predefined boundary) and the fire an even and thru message map i suppose we can handle the situation appropriately?? thanks! norm

          I Offline
          I Offline
          IGeorgeI
          wrote on last edited by
          #4

          I tried SetWindowPos() but it ASSERTS. I was thinking that because I am calling DoModal(), I have lost control of the thing because MFC has taken over. Obviously, any attempts to adjust the position before DoModal() will ASSERT because the dialog window has yet to be created. Any calls after DoModal() is pointless because MFC is in control. I am trying a few different things right now. IGeorgeI :wtf: George W Software Developer www.zsystems.ca

          D 1 Reply Last reply
          0
          • I IGeorgeI

            I tried SetWindowPos() but it ASSERTS. I was thinking that because I am calling DoModal(), I have lost control of the thing because MFC has taken over. Obviously, any attempts to adjust the position before DoModal() will ASSERT because the dialog window has yet to be created. Any calls after DoModal() is pointless because MFC is in control. I am trying a few different things right now. IGeorgeI :wtf: George W Software Developer www.zsystems.ca

            D Offline
            D Offline
            devvvy
            wrote on last edited by
            #5

            hey there, [QUOTE FROM CODE GURU] u can do that by adding the virtual function pretranslatemessage Eg:- BOOL CUrDlg::PreTranslateMessage(MSG* pMsg) { if((pMsg->message == WM_KEYDOWN) ) { if(GetFocus()->GetSafeHwnd() == GetDlgItem(IDC_UR_EDITCTL_ID)->GetSafeHwnd()) //necessary action } return CDialog::PreTranslateMessage(pMsg); } good luck =) Norman norm

            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