Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C Windows
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:
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 11-Sep-12 9:47am
Edited 12-Sep-12 2:56am
v4
Comments
Sergey Alexandrovich Kryukov at 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 at 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 at 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 at 12-Sep-12 8:58am
   
I improved my question and a simple code to show how I create edit controls.
Kenneth Haugland at 11-Sep-12 15:49pm
   
Use WPF if you are not already using it, this problem would be a pice of cake...
Sergey Alexandrovich Kryukov at 11-Sep-12 17:39pm
   
Well.. WPF with C (as tagged)?
--SA
Kenneth Haugland at 11-Sep-12 17:46pm
   
Well, I guess its possible, but Im not used to people tagging the question appropreatly, so I assumend wrongly :-)
Wes Aday at 11-Sep-12 15:51pm
   
Yes you have to create a custom control as that is a non-standard behavior. Most people just use scrollbars....
Kenneth Haugland at 11-Sep-12 15:55pm
   
I dont really understand why he cant use the up and down arrow keys but perhaps Im getting old fashoned.
Wes Aday at 11-Sep-12 15:58pm
   
He's asking about arrows on either side of the control in the window (as I interpret it). And using C....
Kenneth Haugland at 11-Sep-12 16:11pm
   
I see that is C but I still dont understand his problem. BTW: You can use WPF with C++/CLI, whitch Im assuming what he means by C, although C could mean anything Borland etc.
Wes Aday at 11-Sep-12 16:13pm
   
I don't understand his problem either. He could just use scrollbars like the rest of the world and be done with it.
mr.abzadeh at 11-Sep-12 16:23pm
   
I use windows api (native C, visual studio 2010). I do not use .net and wpf

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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
);
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 6,651
1 Sergey Alexandrovich Kryukov 6,400
2 CPallini 5,230
3 George Jonsson 3,574
4 Gihan Liyanage 2,542


Advertise | Privacy | Mobile
Web02 | 2.8.140921.1 | Last Updated 2 Oct 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100