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 Graphics & CEdit scrolling

Problem with Graphics & CEdit scrolling

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

    I have a CEdit control on a dialog box and I'm creating a dynamic rectangle on the CEdit but it doesn't scroll vertically when I put the rectangle on the bottom of the CEdit?!! I've set the multiline+ vertical scroll parameters Please help me! my code has come below: CRect rc, statusRect; GetDlgItem(IDC_GRAPH_EDIT)->GetWindowRect(rc); CWnd* pWnd = GetDlgItem(IDC_GRAPH_EDIT); ScreenToClient(rc); statusRect.top = rc.bottom - 40; statusRect.bottom = statusRect.top + 20; statusRect.left = rc.Width()/2 - 40; statusRect.right = statusRect.left + 80; m_dynamic = new CButton; m_dynamic->Create("Dynamic",WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON|BS_OWNERDRAW|BS_MULTILINE,statusRect,pWnd,2000); m_dynamic->SetFont(fontGeorgia); m_dynamic->SetColor(BLUE, LBLUE); m_dynamic->ShowWindow(SW_SHOW); I've tried the following codes but it didn't help: ((CEdit *)(GetDlgItem(IDC_GRAPH_EDIT)))->SetSel(GetWindowTextLength(),-1); or ((CEdit *)(GetDlgItem(IDC_GRAPH_EDIT)))->PostMessage(WM_VSCROLL, SB_BOTTOM); UpdateData(TRUE); or ((CEdit *)(GetDlgItem(IDC_GRAPH_EDIT)))->LineScroll(2); Any idea or suggestion will be appreciated. thanks

    J 1 Reply Last reply
    0
    • M mfc_surfer

      I have a CEdit control on a dialog box and I'm creating a dynamic rectangle on the CEdit but it doesn't scroll vertically when I put the rectangle on the bottom of the CEdit?!! I've set the multiline+ vertical scroll parameters Please help me! my code has come below: CRect rc, statusRect; GetDlgItem(IDC_GRAPH_EDIT)->GetWindowRect(rc); CWnd* pWnd = GetDlgItem(IDC_GRAPH_EDIT); ScreenToClient(rc); statusRect.top = rc.bottom - 40; statusRect.bottom = statusRect.top + 20; statusRect.left = rc.Width()/2 - 40; statusRect.right = statusRect.left + 80; m_dynamic = new CButton; m_dynamic->Create("Dynamic",WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON|BS_OWNERDRAW|BS_MULTILINE,statusRect,pWnd,2000); m_dynamic->SetFont(fontGeorgia); m_dynamic->SetColor(BLUE, LBLUE); m_dynamic->ShowWindow(SW_SHOW); I've tried the following codes but it didn't help: ((CEdit *)(GetDlgItem(IDC_GRAPH_EDIT)))->SetSel(GetWindowTextLength(),-1); or ((CEdit *)(GetDlgItem(IDC_GRAPH_EDIT)))->PostMessage(WM_VSCROLL, SB_BOTTOM); UpdateData(TRUE); or ((CEdit *)(GetDlgItem(IDC_GRAPH_EDIT)))->LineScroll(2); Any idea or suggestion will be appreciated. thanks

      J Offline
      J Offline
      John R Shaw
      wrote on last edited by
      #2

      CEdit represents a simple text editor, even if you subclassed the control I dought you could do it. The edit-control client area does not actualy scroll, that's an illusion. When you scroll the text it just changes the position of the upper left courner character, where drawing is to start. The edit-control would have to think that your custom-control is part of the text. If you need to insert an object into an edit type control then you should be using CRichEditCtrl, and even then it may need to be an OLE control. INTP "The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes." Andrew W. Troelsen

      M 1 Reply Last reply
      0
      • J John R Shaw

        CEdit represents a simple text editor, even if you subclassed the control I dought you could do it. The edit-control client area does not actualy scroll, that's an illusion. When you scroll the text it just changes the position of the upper left courner character, where drawing is to start. The edit-control would have to think that your custom-control is part of the text. If you need to insert an object into an edit type control then you should be using CRichEditCtrl, and even then it may need to be an OLE control. INTP "The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes." Andrew W. Troelsen

        M Offline
        M Offline
        mfc_surfer
        wrote on last edited by
        #3

        Well.....actually I'm going to draw a graph (some colored rectangles that are connected by some colored arrows) on a dialog. Since the display sould be always like a single vertical line of boxes with a scrolling feature, I though CEdit might be a good choice. Now.. I'm waiting for your suggestion for such an implementation :) Thanks a lot

        J 1 Reply Last reply
        0
        • M mfc_surfer

          Well.....actually I'm going to draw a graph (some colored rectangles that are connected by some colored arrows) on a dialog. Since the display sould be always like a single vertical line of boxes with a scrolling feature, I though CEdit might be a good choice. Now.. I'm waiting for your suggestion for such an implementation :) Thanks a lot

          J Offline
          J Offline
          John R Shaw
          wrote on last edited by
          #4

          If you have not already visited controls section of CP, then give it a shot. There are two graph controls at CP that I know of (one is it ATL/COM section). The other two choice would be to: look into how to use a view (CScrollView) in a dialog box or write your own code to handle the scrolling. INTP "The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes." Andrew W. Troelsen

          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