Solved

Toggle scrolling & wrapping of text

Posted on 2002-04-10
5
242 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
ID: 6932722
theEdit.Invalidate();
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Samsung Galaxy Phones 3 81
Outlook on Android with no lock screen 2 126
iPhone Vibration Programming Question 2 91
bunnyEars2 challenge 6 106
With Windows Embedded Handheld, called Windows Mobile, Microsoft re-designed the user interface. The Start Icon moved down to the bottom, inside the menu bar area.   If you need to hide the Start Icon and/or the SIP (soft input panel, softwar…
You should read OS supplied guidelines before developing. I can't stress that enough. The guidelines will help you understand the reasons mobile app developers do what they do.  Apple is very particular when they review appstore submissions.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.

914 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

18 Experts available now in Live!

Get 1:1 Help Now