Jump to content
  • Advertisement
Sign in to follow this  

scrolling dialogs

This topic is 3080 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello everyone,

I'm trying to create a scrolling dialog containing some bitmaps that you can pick one of them, but im not pretty sure how to do it properly

first off, how to initiate the scrolling dialog? i've got some code from msdn but i couldnt fully understand it, so this is my current code

LRESULT CALLBACK BrowserProc ( HWND wnd, UINT msg, WPARAM wParam, LPARAM lParam )
RECT rc;
GetClientRect ( wnd, &rc );
// Set the vertical scrolling range and page size
si.cbSize = sizeof si;
si.nMin = 0;
si.nMax = ((editor->GetNumImages ( ) + editor->GetNumObjects ( ))/3)*64 > rc.bottom-rc.top ?
((editor->GetNumImages ( ) + editor->GetNumObjects ( ))/3) : 0;
si.nPage = 1;

static int yPos = 0;

switch ( msg )
case WM_SIZE:
SetScrollInfo ( wnd, SB_VERT, &si, TRUE );
// Get all the vertial scroll bar information.
si.cbSize = sizeof si;
si.fMask = SIF_ALL;
GetScrollInfo ( wnd, SB_VERT, &si );

// Save the position for comparison later on.
yPos = si.nPos;
si.nPos = si.nTrackPos;

// Set the position and then retrieve it. Due to adjustments
// by Windows it may not be the same as the value set.
si.fMask = SIF_POS;
SetScrollInfo ( wnd, SB_VERT, &si, TRUE );
GetScrollInfo ( wnd, SB_VERT, &si );

// If the position has changed, scroll window and update it.
if ( si.nPos != yPos )
ScrollWindow ( wnd, 0, 10 * (yPos - si.nPos), NULL, NULL );
InvalidateRect ( wnd, NULL, FALSE );
UpdateWindow ( wnd );

return 0;
case WM_PAINT:
editor->PaintBrowser ( wnd );
return FALSE;
return TRUE;

the main problem is the SCROLLINFO structure, or lets say SCROLLINFO::nPage / SCROLLINFO::nMax, i dont know how to use them, msdn says:



Specifies the maximum scrolling position.

Specifies the page size, in device units. A scroll bar uses this value to determine the appropriate size of the proportional scroll box.

device units are not pixels, are they? if not, what are they then?

my second question is, after having the scroll bar, everything in the window scrolls automatically or i have to set the image positions to fit the new scrolling position?

and my final question is, lets say i want to pick one of the images, how do i do this? if the dialog was not scrollable, i could have just checked the mouse position and picked whatever is lying in that place, but it's different with scrolling dialogs, as the positions are not known for me

Share this post

Link to post
Share on other sites
can you add images to a list view? could you show me the way?

EDIT: Ah i was mixing between list views and list boxes, thanks for mentioning this !

[Edited by - Hassanbasil on July 11, 2010 11:58:20 AM]

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!