Solved

Toggle scrolling & wrapping of text

Posted on 2002-04-10
5
245 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

This article shows how to setup the internet connectivity on Windows Mobile Emulator.   I assume that you already have Microsoft Visual Studio, Microsoft Windows Mobile SDK's and the emulator installed. The emulator is available with Visual Studi…
I recently asked a question (http://www.experts-exchange.com/Programming/Smartphones/Android/Q_28684946.html) about Computer Inventory applications for Mobile Devices.  I was specifically interested in an app I could use on my android phone.  The be…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

809 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