How to stop autoscrolling on the CEdit control.
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: How to stop autoscrolling on the CEdit control.

  1. #1
    Join Date
    Apr 2012
    Posts
    2

    How to stop autoscrolling on the CEdit control.

    Hello,

    I've written some app in MFC for logging through the COM port of my PC, all data I receive I put into CEdit control, and here I have a issue, sometimes it is necessary for me to analyze data and I wish to stop autoscrolling of my control and just freeze on current view for a while, during that time I wish to my incoming data still were written to the control. Is there anybody who can advise me how to accomplish such a functionality ?

    Please take a look on function by which a add data into my control,
    b_DataFreezeToggle variable is a toggle variable I've tried to get number of line to which my view supposed to return after filling control.
    Code:
    void MyDialog::AppendTextToEditCtrl(CEdit& edit, LPCTSTR pszText) {
    	// get the initial text length
    	int nLength = edit.GetWindowTextLength();
    	// put the selection at the end of text
    	edit.SetSel(nLength, nLength);
    	// replace the selection
    	edit.ReplaceSel(pszText);
    	if(b_DataFreezeToggle) { 
    		vs_debug("Selection set %d\n",nFreezedPos) ; 
    		edit.SetSel(nFreezedPos, nFreezedPos,FALSE);
    	}
    }
    Please take a quick look, I'd really appreciate your help

    Cheers
    Lazureus

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,418

    Re: How to stop autoscrolling on the CEdit control.

    Edit control is not convenient for this purpose (simultaneous logging + analyzing).
    ListBox could be more appropriate for this purpose. Have a look at A Logging ListBox Control
    Victor Nijegorodov

  3. #3
    Join Date
    Jul 2005
    Location
    Netherlands
    Posts
    2,013

    Re: How to stop autoscrolling on the CEdit control.

    Quote Originally Posted by lazureus View Post
    Is there anybody who can advise me how to accomplish such a functionality ?
    Did you read the documentation for CEdit::SetlSel? What does the last argument do?
    Cheers, D Drmmr

    Please put [code][/code] tags around your code to preserve indentation and make it more readable.

    As long as man ascribes to himself what is merely a posibility, he will not work for the attainment of it. - P. D. Ouspensky

  4. #4
    Join Date
    Apr 2012
    Posts
    2

    Re: How to stop autoscrolling on the CEdit control.

    Hello,
    thank you very much for your reply, I think Victor's example is what I was looking for Great thanks one more time

    BR,
    Lazureus

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center