Edit Control Questions

This is a discussion on Edit Control Questions within the Windows Programming forums, part of the Platform Specific Boards category; I have two questions. The first is how would I make a set of Edit Controls with Scrollbars scroll simultaneously? ...

  1. #1
    Work in Progress..... Jaken Veina's Avatar
    Join Date
    Mar 2005
    Location
    Missouri. Go Imos Pizza!
    Posts
    256

    Edit Control Questions

    I have two questions. The first is how would I make a set of Edit Controls with Scrollbars scroll simultaneously? I'd like to even have a scrollbar on each one and hve them scroll at the same time no matter which one I use. What message would I use?

    Oh, and is it possible to create an edit box that is editable only by the program or should I just use a Listbox?

  2. #2
    Registered User
    Join Date
    Feb 2005
    Posts
    11

    Wm_vscroll

    MSDN WM_VSCROLL .

    Just intercept this message through your windowproc, use GetScrollPos to get where one control is at and use SetScrollPos to set the second scrollbar.

    Code:
    case WM_VSCROLL: {
         int nScrlPos;
         /*
              Get Scroll Bar Position
              lParam is the Handle of the control sending the position
         */
         nScrlPos = GetScrollPos(lParam, SB_VERT);
    
         /*
              Set the sister control scroll bar to the same position
              Remember, the positions are relative, the heights are
              not the same, the scroll bars will not look as if they are
              scrolling in sync
              g_hEditCtrl2 is the handle of the second edit control
         */
         SetScrollPos(g_hEditCtrl2, SB_VERT, nScrlPos, TRUE);
    
         /*
              The link above links to the GetScrollPos and SetScrollPos
              so you can get more in depth info
         */
    
         break;
    }
    As for your second question, check out this: EM_SETREADONLY

    Hope that helps...

  3. #3
    Work in Progress..... Jaken Veina's Avatar
    Join Date
    Mar 2005
    Location
    Missouri. Go Imos Pizza!
    Posts
    256
    Perfect. Thanks a lot.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. can't disable ctrl-V on a rich edit control
    By rakan in forum Windows Programming
    Replies: 1
    Last Post: 02-06-2008, 08:37 AM
  2. Appending text to an edit control
    By dit6a9 in forum Windows Programming
    Replies: 3
    Last Post: 08-13-2004, 10:52 PM
  3. Restricting input to an edit control
    By bennyandthejets in forum Windows Programming
    Replies: 7
    Last Post: 10-05-2003, 02:10 AM
  4. endless edit control
    By ZerOrDie in forum Windows Programming
    Replies: 3
    Last Post: 03-21-2003, 02:51 AM
  5. Keeping focus on an edit control ...
    By Unregistered in forum Windows Programming
    Replies: 3
    Last Post: 02-19-2002, 02:12 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21