Click here to Skip to main content
15,891,513 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hello everyone
I want create windows API application and put singleline edit controls on it.
The edit controls should have two arrows at sides to scroll horizontally using mouse. I could not find any edit styles to do this in windows edit controls. Is there any other way to do this, other than creating customized controls?
Thanks in advanse
abzadeh
Edit:
my code to create edit control as this:
C++
int iStyleEx = WS_EX_CLIENTEDGE;
int iStyle = WS_BORDER | WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL;
static wchar_t wszBuffer[400];
HWND hWndEdit = CreateWindowExW( iStyleEx, L"EDIT", wszBuffer, iSstyle,
		cpx, cpy, cpWidth, cpHeight, hwndDlg, NULL, hInst, NULL );
As there is no simple way to add arrows to both sides of edit control to scroll horizontally, I think the best way to solve this problem is to create two button controls to left and right of edit control, and handle their WM_LBUTTONDOWN and WM_LBUTTONUP events.
The button controls should paint arrows.
Posted
Updated 12-Sep-12 2:56am
v4
Comments
Sergey Alexandrovich Kryukov 11-Sep-12 15:48pm    
Did you try to type a really long text? I think you should not see those arrows if the text fits...
--SA
mr.abzadeh 11-Sep-12 15:59pm    
I am not able to put arrows there, and edit control has no arrows by default, even for long text.
Sergey Alexandrovich Kryukov 11-Sep-12 17:38pm    
Really? Hm... Than perhaps you could create a really short code sample to show what is you code and to reproduce this problem only? If so, please use "Improve question".
--SA
mr.abzadeh 12-Sep-12 8:58am    
I improved my question and a simple code to show how I create edit controls.
Kenneth Haugland 11-Sep-12 15:49pm    
Use WPF if you are not already using it, this problem would be a pice of cake...

1 solution

Maybe this function could help

ScrollWindowEx function

int ScrollWindowEx(
_In_ HWND hWnd,
_In_ int dx,
_In_ int dy,
_In_ const RECT *prcScroll,
_In_ const RECT *prcClip,
_In_ HRGN hrgnUpdate,
_Out_ LPRECT prcUpdate,
_In_ UINT flags
);
 
Share this answer
 

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