Click here to Skip to main content
15,886,788 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all- I have two splitters in the ChildFrame: one horizontal, and one vertical on the first half of the horizontal pane.
if (!m_wndHSplitter.CreateStatic(this, 2, 1) ||
    !m_wndVSplitter.CreateStatic(&m_wndHSplitter, 1, 2) ||
    !m_wndVSplitter.CreateView(0, 0, RUNTIME_CLASS(CMysqlQueryEditView), CSize(0, 0), pContext) ||
    !m_wndVSplitter.CreateView(0, 1, RUNTIME_CLASS(CMysqlQueryTreeView), CSize(0, 0), pContext) ||
    !m_wndHSplitter.CreateView(1, 0, RUNTIME_CLASS(CMysqlQueryListView), CSize(0, 0), pContext))
  return FALSE;

I use a RichEditView in the left pane of the vertical splitter and cannot get the horizontal scroll work properly. I get the VSCROLL only. The control goes to a new line when reaching the end of the visible window.

What I have tried:

1/ I make sure the cs.style is set to
WS_HSCROLL | ES_AUTOHSCROLL | WS_VSCROLL | ES_AUTOVSCROLL | ES_MULTILINE;
on the view's PreCreateWindow;
2/ I've tried to set the style again before the view's OnCreate;
3/ I've tried to set the style in the OnInitialUpdate using ModifyStyle;
4/ And tried also to use the control
GetRichEditCtrl().SetOptions(ECOOP_SET, ECO_NOHIDESEL | ECO_SAVESEL | ECO_AUTOVSCROLL | ECO_AUTOHSCROLL | ECO_AUTOWORDSELECTION | ECO_WANTRETURN);

5/ Tried to replace CMyRichEditView by CEditView in the splitter pane creation and everything works fine, H & V scrolls.

Any idea? Thanks
Posted
Updated 25-Nov-19 6:37am
v3

1 solution

It will only scroll if the user types a single set of characters that is wider than the window. Otherwise it automatically breaks lines at word boundaries in order to fit the width.
 
Share this answer
 
Comments
Pascal92RT 25-Nov-19 13:01pm    
Thanks Richard. I'm not sure I understand what you mean or what is the solution. If I type a single set of character or different words, the control breaks at the end of the window and goes to a new line
Richard MacCutchan 25-Nov-19 15:31pm    
Just start typing random characters with no spaces and when it gets to the right hand edge it will start to scroll.
Pascal92RT 25-Nov-19 16:10pm    
No, if I continue typing the same character it breaks the line and starts a new one, without scrolling
Richard MacCutchan 27-Nov-19 4:47am    
It worked correctly for me.
Pascal92RT 25-Nov-19 13:10pm    
Moreover I did triple (or more :)) check the documentation which says that the user must press Enter key when using MULTILINE & AUTOHSCROLL in order to get a new line:

ES_MULTILINE
If you specify the ES_AUTOHSCROLL style, the multiline edit control automatically scrolls horizontally when the caret goes past the right edge of the control. To start a new line, the user must press the ENTER key. If you do not specify ES_AUTOHSCROLL, the control automatically wraps words to the beginning of the next line when necessary. A new line is also started if the user presses the ENTER key. The window size determines the position of the Wordwrap. If the window size changes, the Wordwrapping position changes and the text is redisplayed.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900