Click here to Skip to main content
15,880,427 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello, I am developing an application for Right to Left reading. I am inserting a file data into a rich edit control. When the data crosses width of a control, it introduces a horizontal scroll bar. But this scroll bar is put to left end instead of right end. I tried with some try outs as follows:

1)Changed rich edit styles for Right to Left reading & right aligned text.

2)Sent an explicit Scroll bar message, to set it at right extreme.

3)Retrieved scroll bar's info & set its position to Maximum. But none worked.

Is there any way to make it right aligned by default? Thanks in advance.
Posted
Comments
Kornfeld Eliyahu Peter 22-Sep-14 3:11am    
Should it be that your OS version does not support right-to-left layout?
Sam L 6-Oct-14 1:52am    
Hello,
I am doing all this on WinXP Arabic, & it is supporting other applications like Notepad, a right-to-left layout.

1 solution

Hi Sam,

Probably not the perfect solution but you may try this:
C++
//scroll to far right
m_RichCtrl.SendMessage(WM_HSCROLL, SB_RIGHT);
//scroll back 1 page
m_RichCtrl.SendMessage(WM_HSCROLL, SB_PAGELEFT);

Put this code at the end of OnInitDialog for example.

Olivier.
 
Share this answer
 
Comments
Sam L 23-Sep-14 0:57am    
Hello Olivier,
Thanks for your suggestion. But this code works partially for some situations. In some cases it moves the scroll bar by page, such that the right side content is not shown(which should be shown in right to left reading case).
Olivier Levrey 23-Sep-14 4:16am    
Could you provide a piece of code to reproduce this case? If I can reproduce it, maybe I can also find a workaround for it.
Sam L 23-Sep-14 4:40am    
FillRichEdit() //this function is used to fill rich edit with // a file data
{
//Read data from a file
//Set it to rich edit through SetWindowText()
m_RichCtrl.SendMessage(WM_HSCROLL, SB_RIGHT);
m_RichCtrl.SendMessage(WM_HSCROLL, SB_PAGELEFT);
}
Olivier Levrey 23-Sep-14 4:48am    
I use the same code and I don't have any problem. It probably comes from the content. Try without the file first. For example try with m_RichCtrl.SetWindowText("blabla").
Sam L 23-Sep-14 5:35am    
Ok. Have you tried with Arabic/Hebrew language? It is having problem with that.

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