Click here to Skip to main content
16,020,673 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi ,

i have problem with creating a window with scroll bar, here i am creating child window with scrollbar's but the problem is scrollbar's are in disabling state. is there any way can we able to create a scroll bars to a childwindow.
We are in document management system so we need to show files(PDF) in viewer by creating child windows , so the child window is creating the problem.
Finally I want solution in Win32.

What I have tried:

CreateWindowEx(0L,L"static",NULL,WS_CHILD| WS_VISIBLE | WS_CLIPSIBLINGS | WS_VSCROLL | WS_HSCROLL ,0,0,0,0,(HWND)pDataSurface,0,(HINSTANCE)GetWindowLong((HWND)pDataSurface,GWL_USERDATA),0);
Posted

The scrollbars only become enabled when you set the size of the view and the amount of data to be scrolled. See SetScrollInfo function (Windows)[^].
 
Share this answer
 
There is no automatic setting of scroll bar ranges and positions (besides some special control window types). It must be implemented by you according to the data shown in the window.

For a viewer, you have to initialise the scroll bar ranges and positions from the viewing content (e.g. number of rows and columns) using SetScrollInfo and implement handlers that will scroll the view according to the scroll bar actions.
 
Share this answer
 
The function EnableScrollBar should solve the problem.

The child window should be greater than the parent with the scrollbars, or the scrollbars getting disabled.
 
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