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. problem with a second DIALOGBAR

problem with a second DIALOGBAR

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++question
4 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.
  • A Offline
    A Offline
    aguest
    wrote on last edited by
    #1

    hello i work on MFC project SDI,and i have add to my window a new DIALOGBAR ,and i want to add in it some control like slider and button but i have a problem how i can get message from a slider because the new DIALOGBAR is child and not main and one of this problem is: when i add slider and one EditBox and i want to watch the progression number of the slider in the Edit no thing happned. can you help me please?????

    M 1 Reply Last reply
    0
    • A aguest

      hello i work on MFC project SDI,and i have add to my window a new DIALOGBAR ,and i want to add in it some control like slider and button but i have a problem how i can get message from a slider because the new DIALOGBAR is child and not main and one of this problem is: when i add slider and one EditBox and i want to watch the progression number of the slider in the Edit no thing happned. can you help me please?????

      M Offline
      M Offline
      MemLeak
      wrote on last edited by
      #2

      Hi, Because the dialogbar is a child, you have to catch the message from the slider control into the parent window. You have to catch the slider message with onHScroll() or onVScroll(). So into your parent window (probably the mainframe) you can put into your mainframe.h: CSliderCtrl myslider; and void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); into your mainframe.cpp DDX_Control(pDX, IDC_MYSLIDER, myslider); ON_WM_HSCROLL() and void mainframe::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) { CSliderCtrl* slider = (CSliderCtrl*) pScrollBar; int position = slider->GetPos(); OnHScroll(nSBCode, nPos, pScrollBar); } so after having the position, you can put the value into the edit box. It's up to you from now bye Everything's beautiful if you look at it long enough...

      A M 2 Replies Last reply
      0
      • M MemLeak

        Hi, Because the dialogbar is a child, you have to catch the message from the slider control into the parent window. You have to catch the slider message with onHScroll() or onVScroll(). So into your parent window (probably the mainframe) you can put into your mainframe.h: CSliderCtrl myslider; and void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); into your mainframe.cpp DDX_Control(pDX, IDC_MYSLIDER, myslider); ON_WM_HSCROLL() and void mainframe::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) { CSliderCtrl* slider = (CSliderCtrl*) pScrollBar; int position = slider->GetPos(); OnHScroll(nSBCode, nPos, pScrollBar); } so after having the position, you can put the value into the edit box. It's up to you from now bye Everything's beautiful if you look at it long enough...

        A Offline
        A Offline
        aguest
        wrote on last edited by
        #3

        i was made all what you tell me but it have an error in DDX_Control(pDX, IDC_MYSLIDER, myslider); it's ask that pDX undeclared identifier,why?and when i must put it in the constructor or where exactely.

        1 Reply Last reply
        0
        • M MemLeak

          Hi, Because the dialogbar is a child, you have to catch the message from the slider control into the parent window. You have to catch the slider message with onHScroll() or onVScroll(). So into your parent window (probably the mainframe) you can put into your mainframe.h: CSliderCtrl myslider; and void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); into your mainframe.cpp DDX_Control(pDX, IDC_MYSLIDER, myslider); ON_WM_HSCROLL() and void mainframe::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) { CSliderCtrl* slider = (CSliderCtrl*) pScrollBar; int position = slider->GetPos(); OnHScroll(nSBCode, nPos, pScrollBar); } so after having the position, you can put the value into the edit box. It's up to you from now bye Everything's beautiful if you look at it long enough...

          M Offline
          M Offline
          MemLeak
          wrote on last edited by
          #4

          Hi, DDX_Control(pDX, IDC_MYSLIDER, myslider); into DoDataExchange(CDataExchange* pDX) ON_WM_HSCROLL() into the MessageMap bye Everything's beautiful if you look at it long enough...

          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