Solved

Toggle scrolling & wrapping of text

Posted on 2002-04-10
5
238 Views
Last Modified: 2013-12-27
I'm creating an app using WCE and I'm trying to get the
display to toggle wrapping and scrolling of text.  

The scrollbar appears and disapears, but the text won't
redraw, it stays in its previous state.  

I'm reading the text currently displayed into a buffer,
change scrolling state, and then redraw text.

Any ideas??  Thanks!!

Here's my code:

void CTextViewerView::OnViewWrappedtowindow()
{
        CString RedrawTextBuffer;
     CEdit& theEdit = GetEditCtrl();
     
     //Read Text from window
     GetWindowText(RedrawTextBuffer);      
     LPTSTR p = RedrawTextBuffer.GetBuffer(65536);
     
     CWnd* pMain = AfxGetMainWnd();
     CMenu* menu_bar = pMain->GetMenu();
     CMenu* view_menu = menu_bar->GetSubMenu(2);

        //Change display of Window (Wrapping or Scrolling)
     if (WrapText)
     {                       //Add scrollbar
          ModifyStyle(0, ES_AUTOHSCROLL|WS_HSCROLL);
          view_menu->CheckMenuItem
(ID_VIEW_WRAPPEDTOWINDOW, MF_BYCOMMAND | MF_UNCHECKED);
          WrapText = 0;
     }
     else
     {                          //Do Word Wrap
          ModifyStyle(ES_AUTOHSCROLL|WS_HSCROLL, 0);
     
          view_menu->CheckMenuItem
(ID_VIEW_WRAPPEDTOWINDOW, MF_BYCOMMAND | MF_CHECKED);
          WrapText = 1;
     }

        //Reset text to new window
     theEdit.SetWindowText((LPCTSTR)p);

//Tried to add the following but doesn't help
/*     ShowWindow(SW_SHOW);
     pMain->UpdateWindow();

     OnUpdate(NULL, 0, NULL);
*/
}
0
Comment
Question by:bfeller2
5 Comments
 
LVL 23

Accepted Solution

by:
chensu earned 50 total points
Comment Utility
theEdit.Invalidate();
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

I think the most popular question in our Windows Mobile Programming zone is about the backlight - we all want to keep it on when our application is running. Few years ago the function SystemIdleTimerReset() did this job. On our side we had to detec…
In this article we will discuss all things related to StageFright bug, the most vulnerable bug of android devices.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now