473,382 Members | 1,717 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

CEdit window update problem

Hi all,

I have a CEdit window in my application which I use as a sort of output console for text generated by my program.

Each subsection writes to its own string buffer and every 2 seconds I update the window. for this I use the following code. this is code I found on the internet.


Expand|Select|Wrap|Line Numbers
  1. CEdit ctrlPad;
  2.  
  3. Frame::update(){
  4.         string all = output + searchOutput + nl + resultOutput + nl;
  5.         ctrlPad.SetWindowText(Text::toT(all).c_str());
  6.         UpdateLayout();
  7. }
  8.  
  9. Frame::UpdateLayout()
  10. {
  11.     CRect rc;
  12.  
  13.     GetClientRect(rc);
  14.  
  15.     rc.bottom -= 1;
  16.     rc.top += 1;
  17.     rc.left +=1;
  18.     rc.right -=1;
  19.     ctrlPad.MoveWindow(rc);
  20. }
  21.  

the code works in the way that it indeed updates the window. the problem is that it also puts the current view of the document at the top. this is rather irritating if the output stretches a couple of pages and every 2 seconds you get booted back to the top of the first page.

the question is how do I modify this code so that additional text is added to the window without the view jumping to the top.

I hope the problem is clear, it is not easy to explean without actualy seeing it :)

anyway thanks in advance for helping :p,
stefaan
Jul 17 '07 #1
2 2711
weaknessforcats
9,208 Expert Mod 8TB
The MoveWindow is inherited from CWnd. There are two overloads. The one you are using requires a struct and it calls Win32 MoveWindow with a repaint argumnet set to true. The repaint is most likely causing you windows to move on top.

Try the other overload:
Expand|Select|Wrap|Line Numbers
  1. Frame::UpdateLayout()
  2. {
  3.     CRect rc;
  4.  
  5.     GetClientRect(rc);
  6.  
  7.     rc.bottom -= 1;
  8.     rc.top += 1;
  9.     rc.left +=1;
  10.     rc.right -=1;
  11.     ctrlPad.MoveWindow(rc.left, rc.top, rc.right, rc.bottom, FALSE);
  12. }
  13.  
You will need to redraw as necessary.

This is just a guess. Let me know what happens.
Jul 17 '07 #2
I have tried it, and it doesn't seem to make a difference :(

anymore idea's out there?

thanks,
stefaan
Jul 18 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: ragi | last post by:
I need put small animated gifs (like emoticons) into CEdit control in place of blinkinh caret. Thanks for help.
4
by: ced | last post by:
Hallo, I have some JS which creates a new 2-frame window. The new window (via onLoad) backfills a variable in the parent window so I'll know when it's safe to load the target frame. The...
2
by: garrry | last post by:
Here is the situation (in VisualC++6 environment): 1. some number is enterd into a CEdit window by user 2. the application has to obtain that number and do some calculations with it (just...
1
by: hamm.charlesw | last post by:
I have a small app that filters out illegal characters typed into a CEdit by doing a GetWindowText(), followed by the filtering, followed by a SetWindowText(), all within a routine fired from an...
1
by: rag84dec | last post by:
Hi, I am trying to write an MFC code which has the Dialog which has a menu option Edit which has an option "Copy File content"... Now i want to get the text entered in the Edit box.What function...
1
by: rag84dec | last post by:
HI, I have an MFC code which has a dialog and a menu.One menu option is Edit which has "Copy File content".There are 2 CEdit boxs.IDC_EDIT2 and IDC_EDIT3.I am reading the text in the Edit boxes. ...
0
xarzu
by: xarzu | last post by:
How do you change the enabled state of an CEdit control? There does not seem to be any CEdit or CWnd member function that will do it. In MSDN, there mentions something about a Control Table. ...
0
by: abhishekjha22 | last post by:
Hi, I have a CEdit control. I can accept only 4 characters and that should be Numeric and no spaces allowed. I want to set the contents of the Editbox empty. But when i try to do edit.SetText("...
7
by: Hiep Nguyen | last post by:
Hello, i'm looking for a javascript solution to the following problem: I have two pages: list.php and update.php on list.php page, i have a hyperlink to update.php page (open a new window). ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.