Hi,

Can anyone point me in the direction of a sample which scrolls a dialog
containing child controls?

It seems a reasonable thing to do - but none of the sample projects
demonstrate it.
For instance the demo CECamara presents an entry dialog with controls and a
scrollbar, yet the scrolling is not implemented.

I've hunted around and found a few code snippets that give a hint on how to
do it but I have been unsuccessful - my code either does nothing or crashes
the emulator.

I am working in native win32 C++ and such an example would be great, but
even an MFC example which worked would be appreciated as at least it might
put me on the right track.

TIA.

Re: Scrolling a dialog by Christopher

Christopher
Sun Dec 09 14:25:51 PST 2007

Hi,

"Jasper" <notaround@dontmail.com> wrote in message
news:tq6dnR33t5UX8sXanZ2dnUVZ8qminZ2d@pipex.net...
> Hi,
> Can anyone point me in the direction of a sample which scrolls a dialog
> containing child controls?

I don't have a nice tidy tutorial or article to point you at, however you
might like to take a look at
http://portablepuzzlecollection-wm.googlecode.com/svn/trunk/windowsce.c, in
particular the ConfigDlgProc function, since this demonstrates a real life
example of scrolling a dialog.

The key is to use the ScrollWindowEx API with the SW_SCROLLCHILDREN flag.
This API can be utilised to move the contents of your window up or down a
set number of pixels (as is done within the WM_VSCROLL message handler in
the code I referenced above).

Then it is simply a matter to configure your scrollbar to have the desired
height etc. One way to calculate the required scrolling region is to store
somewhere the maximum height of your window, then whenever the window is
resized you can calculate the difference in height, and hence much needs to
be scrolled out of view.

Hope this helps,
Christopher Fairbairn

PS: The code sample I linked to above is part of my ongoing port of Simon
Tatham's Portable Puzzle collection to Windows Mobile. See
http://code.google.com/p/portablepuzzlecollection-wm/ for further details.


Re: Scrolling a dialog by Jasper

Jasper
Mon Dec 10 06:28:32 PST 2007


"Christopher Fairbairn" <christopher@christec.co.nz> wrote in message
news:728F6162-FC91-4B35-B3B4-32A92D22FFF3@microsoft.com...
> Hi,
>
> "Jasper" <notaround@dontmail.com> wrote in message
> news:tq6dnR33t5UX8sXanZ2dnUVZ8qminZ2d@pipex.net...
>> Hi,
>> Can anyone point me in the direction of a sample which scrolls a dialog
>> containing child controls?
>
> I don't have a nice tidy tutorial or article to point you at, however you
> might like to take a look at
> http://portablepuzzlecollection-wm.googlecode.com/svn/trunk/windowsce.c,
> in particular the ConfigDlgProc function, since this demonstrates a real
> life example of scrolling a dialog.

Thanks for the link Chris, I'll take a look. I had decided on scrolling the
controls manually with MoveWindow but I'll see if I can get "real" scrolling
working.

PS I did include SW_SCROLLCHILDREN so I must have bee doing something else
worong also.




Re: Scrolling a dialog by Jasper

Jasper
Mon Dec 10 07:33:12 PST 2007


"Jasper" <notaround@dontmail.com> wrote in message
news:z4GdneogBaeN0MDanZ2dnUVZ8uWdnZ2d@pipex.net...
>
> "Christopher Fairbairn" <christopher@christec.co.nz> wrote in message
> news:728F6162-FC91-4B35-B3B4-32A92D22FFF3@microsoft.com...
>> Hi,
>>
>> "Jasper" <notaround@dontmail.com> wrote in message
>> news:tq6dnR33t5UX8sXanZ2dnUVZ8qminZ2d@pipex.net...
>>> Hi,
>>> Can anyone point me in the direction of a sample which scrolls a dialog
>>> containing child controls?
>>
>> I don't have a nice tidy tutorial or article to point you at, however you
>> might like to take a look at
>> http://portablepuzzlecollection-wm.googlecode.com/svn/trunk/windowsce.c,
>> in particular the ConfigDlgProc function, since this demonstrates a real
>> life example of scrolling a dialog.
>
> Thanks for the link Chris, I'll take a look. I had decided on scrolling
> the
> controls manually with MoveWindow but I'll see if I can get "real"
> scrolling
> working.
>
> PS I did include SW_SCROLLCHILDREN so I must have bee doing something else
> worong also.

Chris,

Had a quick look. Looked at config options for Bridges.

The "default" PPC scrolling isn't any nicer than MoveWindow() scrolling from
what I can see.

Also, re your code, don'y know if you are aware but if you raise the SIP
the window is not resized to allow for it.

Cheers, J







Re: Scrolling a dialog by Christopher

Christopher
Mon Dec 10 12:34:58 PST 2007

Hi Jasper,

"Jasper" <notaround@dontmail.com> wrote in message
news:DZidnamfLeGlwcDanZ2dnUVZ8tignZ2d@pipex.net...
> The "default" PPC scrolling isn't any nicer than MoveWindow() scrolling
> from what I can see.

In effect both techniques are doing the same thing internally. Calling
ScrollWindowEx effectively just calls MoveWindow for you behind the scenes
and hides the code to enumerate child windows etc.

> Also, re your code, don'y know if you are aware but if you raise the SIP
> the window is not resized to allow for it.

Opps, that looks like a regression :-S I haven't had much time recently to
work on improving this port, but I'll definatly put that issue into the bug
tracker.

Hope it helps,
Christopher Fairbairn