|
Not sure that I understand. When you say "get messages from the board" do you mean the keyboard? I also don't understand how adding text to a rich edit control moves the scroll bar up. If you add text to the end of the edit control then the scroll bar moves down for me. The text does move up.
Perhaps you can try LineScroll() with a negative number of lines. For instance
MyEdit.LineScroll(MyEdit.GetFirstVisibleLine(), 0)
makes the top line of the text in the edit control visible
Graham
Librarians rule, Ook!
|
|
|
|
|
Hi Graham,
thanks for ur reply. I'm explaining the problem on behalf of Balaji.
Problem :
Information in Rich Text Box are updated by thread, whenever thread gets message(text), it will be updated on RichTextBox Control.
Right now, we are concatenaing the message(text) and update the concate_string in the RichTextControl, using the following API,
myRichTextBox.SetText(concat_string);
What we are suppose to do is, recently updated text should be visible to user.
To view the recent text, we are using scroll bars manually. Instead, we want to display the last updated text.
we are using Rich Text Box 6.0 (SP4). we tried with the following APIs,
myEdit.SetScrollBar();
but it's throwing Error..
Thanks
Ram
|
|
|
|
|
OK, things are a lot clearer now, thanks. I was assuming that you were using the CRichEditCtrl from MFC, but you are actually using RichTextBox from the .Net framework library
What I think you want to do is:
a) Before appending the message to the RichTextBox get the current length of the text from the TextLength property. This is the char index of the last character of the last message
b) Calculate the line number of this position using GetLineFromCharIndex
c) Append the text
d) Calculate the line number that you want at the bottom of the display from the number calculated in b) plus the number of lines in the display
e) Calculate the char index of the beginning of the line calculated in d) using the GetFirstCharIndexFromLine
f) Set the caret to begining of the line calculated above using the Select method
g) Scroll the caret to the bottom of the display using the ScrollToCaret() method
The following code should do it (note I have not tested this yet)
int line = myRichTextBox.GetLineFromCharIndex(myRichTextBox.TextLength);
myRichTextBox.SetText(concat_string);
int pos = myRichTextBox.GetFirstCharIndexFromLine(line + NumberOfLinesInRichTextBox(myRichTextBox));
myRichTextBox.Select(pos, pos);
myRichTextBox.ScrollToCaret();
As in a previous answer[^] the function NumberOfLinesInRichTextBox could either return a constant value determined by experiment or calculate the number of visible lines in the RichTextBox using Text Metrics.
Apologies for not having time at the moment to test this out, but I hope I've given you enough of a steer to allow you to get this working
Graham
Librarians rule, Ook!
|
|
|
|
|
hi i am trying to display icons or bitmaps on popup menu and on status bar for dialog based application.
i got some demo examples for this but those examples are for MDI & SDI,i applied whatever logic is there for MDI n SDI but that is not working for dialog box n i want to show this for a dialog based application only.
thanks in advance
|
|
|
|
|
|
thanks Hamid.
Putting a Progress Bar, BitMap, Animation or Dialog in a Multi Pane Status Bar (The Easy Way).
i tried to run this application but it is getting crashed.
|
|
|
|
|
this application is giving some compile time errors
|
|
|
|
|
|
Can you show your errors?
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
thanks Hamid,
it is working now.
can u plz tell me how to divide status bar panes into 3 equal parts of a dialog box?
|
|
|
|
|
I think you cant do it.
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
i have done that n that is working properly.
i could do this coz of demo of i got 1 class ie CBmpMenu.
|
|
|
|
|
Hi all
I would like to stop executing the
std::getline( std::cin, aString )
function from another thread
when getline is blocked waiting for user input.
A possible solution is to put the function into another thread
and stop this last when I need.
Instead of using another thread, is there some global
function or OS function that is possible to call?
I imagine since std::cin should be running in a OS
thread, right?...maybe some signal?
Thanks for your help
ManuStone
|
|
|
|
|
|
|
could any1 tell me how to put a back ground picture in a mfc dialog?
|
|
|
|
|
See here[^]
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
|
Please let me how to change the font of parent node and also how to make it BOLD in tree control.
Thanks in Advance
|
|
|
|
|
There is no TVM_SETITEMFONT message, and TVITEM has no font member - so you're going to have to roll your sleeves and do it yourself.
Or, there are plenty of articles on codeproject to do with owner draw tree controls.
It's a shame, though - I'd think font is quite a good extension to a tree view item properties. But it's not up to me!
Good luck,
Iain.
|
|
|
|
|
You can change the font with custom draw. Handle NM_CUSTOMDRAW and select a new font into the DC that you get with the message. Bolding an item is built-in, set the TVIS_BOLD style on the node (or you can just select a bold font when you handle NM_CUSTOMDRAW ).
|
|
|
|
|
I am trying to build this custom control - one of the child windows is an edit control and at one point it gets the focus (you can type in it) but the cursor has disappeared... what could cause this and how can I fix this?
Thanks in advance
modified on Monday, December 8, 2008 9:43 AM
|
|
|
|
|
That's the default behaviour of the edit field, you can see the same behaviour in a lot of programs, when you start typing, it hides the mouse cursor. Just run notepad and start typing...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|
|
No - the cursor disappears and does not come back... I can ensure you it's not the default behaviour!
|
|
|
|
|
Doesn't come back even if you move the mouse?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|