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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Problem with SetRect

Problem with SetRect

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

    I'm trying to implement a CEdit box that has a horizantal scroll bar that will fill up to 1000 characters at a time. I used SetLimitText to set the limit to 1000 characters. The problem cropped up when I tried to use SetRect(). After I called the function it would not let me place the cursor in the box anymore. I can still call ReplaceSel() and place text in the box that way, but I cannot type it in with the keyboard. Some of the code: SearchStringEditBoxPtr->SetLimitText(1000); RECT EditBoxDimensions; EditBoxDimensions.left = 0; EditBoxDimensions.top = 0; EditBoxDimensions.right = 3000; EditBoxDimensions.bottom = 12; SearchStringEditBoxPtr->SetRect(&EditBoxDimensions); Resource defenition statement for the edit box: EDITTEXT IDC_DLGS_SEARCHSTRING_STRINGTEXT, 83, 190, 200, 24, ES_MULTILINE | WS_HSCROLL I would appreciate any help. -John

    M 1 Reply Last reply
    0
    • C CoffeeAddict19

      I'm trying to implement a CEdit box that has a horizantal scroll bar that will fill up to 1000 characters at a time. I used SetLimitText to set the limit to 1000 characters. The problem cropped up when I tried to use SetRect(). After I called the function it would not let me place the cursor in the box anymore. I can still call ReplaceSel() and place text in the box that way, but I cannot type it in with the keyboard. Some of the code: SearchStringEditBoxPtr->SetLimitText(1000); RECT EditBoxDimensions; EditBoxDimensions.left = 0; EditBoxDimensions.top = 0; EditBoxDimensions.right = 3000; EditBoxDimensions.bottom = 12; SearchStringEditBoxPtr->SetRect(&EditBoxDimensions); Resource defenition statement for the edit box: EDITTEXT IDC_DLGS_SEARCHSTRING_STRINGTEXT, 83, 190, 200, 24, ES_MULTILINE | WS_HSCROLL I would appreciate any help. -John

      M Offline
      M Offline
      Mark Salsbery
      wrote on last edited by
      #2

      Are you sure 12 is large enough for the height? :) Mark

      Great job, team. Head back to base for debriefing and cocktails.

      C 1 Reply Last reply
      0
      • M Mark Salsbery

        Are you sure 12 is large enough for the height? :) Mark

        Great job, team. Head back to base for debriefing and cocktails.

        C Offline
        C Offline
        CoffeeAddict19
        wrote on last edited by
        #3

        That solved the problem. I can type text into it now. It dosen't scroll anymore though. HMMhmmm....

        M 1 Reply Last reply
        0
        • C CoffeeAddict19

          That solved the problem. I can type text into it now. It dosen't scroll anymore though. HMMhmmm....

          M Offline
          M Offline
          Mark Salsbery
          wrote on last edited by
          #4

          Are you trying to keep all the entered text on one line? The default formatting rect should work fine in that case (updating the horizontal scrollbar appropriately).

          Great job, team. Head back to base for debriefing and cocktails.

          C 1 Reply Last reply
          0
          • M Mark Salsbery

            Are you trying to keep all the entered text on one line? The default formatting rect should work fine in that case (updating the horizontal scrollbar appropriately).

            Great job, team. Head back to base for debriefing and cocktails.

            C Offline
            C Offline
            CoffeeAddict19
            wrote on last edited by
            #5

            Yes...I don't know why I always do things the hard way. Man I feel stupid. It works now though.

            M 1 Reply Last reply
            0
            • C CoffeeAddict19

              Yes...I don't know why I always do things the hard way. Man I feel stupid. It works now though.

              M Offline
              M Offline
              Mark Salsbery
              wrote on last edited by
              #6

              :) By the way, I tried it just for the heck of it (I've never changed the formatting rect on a regular edit before). If you enter enough text until you reach 3000 pixels width then the scrollbar starts to work. I suppose, then, that the appropriate width for the rect when you have a horizontal scrollbar is the width of the control. Kewl. Cheers! Mark

              Great job, team. Head back to base for debriefing and cocktails.

              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