Solved

Toggle scrolling & wrapping of text

Posted on 2002-04-10
5
250 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 23

Accepted Solution

by:
chensu earned 50 total points
ID: 6932722
theEdit.Invalidate();
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Preface: This article is part of a series focused on cross platform mobile app development (specifically Android and iOS) using the Alloy framework and Titanium Studio made by Appcelerator (https://www.appcelerator.com/). This article presumes a wor…
If you are anything like me, you install many apps on your phone and have your life on it, sometimes literally.  When I bought my current phone, a Samsung Galaxy S5 from Verizon, they were only selling the versions with 16 GB internal.  I didn't rea…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

726 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