Re: CScrollBar resizing the scrollbox in relation to SetScrollRange() ?
"RAN" <nijenhuis@wish.nl> wrote in message
news:1187537197.934151.95400@d55g2000hsg.googlegroups.com...
On Aug 19, 4:38 pm, RAN <nijenh...@wish.nl> wrote:
Hi,
I have created a vertical CScrollBar in OnCreate of my CDialog
(Modal):
o_ChatTextEntryScrollBar.Create(SBS_VERT | SBS_RIGHTALIGN |
SBS_LEFTALIGN | WS_CHILD, CRect(1005, 63, 0, 600), this, 1002);
I want the scrollbox to be automatically resized according to the
range specified by SetScrollRange(). I mean if i call SetScrollRange()
with a different value , it should resize the scrollbox !?
If i open an empty document in VC the scrollbox is at its maximum
size, if i paste text in the empty document the scrollbox
automatically resizes to a smaller size. (to a specified range i
suspect ?)
How does this works for ScrollBars ?
If my view (ocx) is full (34 lines of text) the next line entered
should enable the scrollbar which it does and than i set the range
from 0 to 1. because 1 line is now out of sigth by entering line no.
35. The scrollbox stays small and should be almost the maximum size (i
mean i think thats what it automatically should do.) No matter what
range i set the scrollbox is always the same size!?
I think i have to do something with the nPage variable of SCROLLINFO:
SCROLLINFO info;
info.cbSize = sizeof(SCROLLINFO);
info.fMask = SIF_ALL;
info.nMin = 0;
info.nMax = 10;
info.nPage = 2;
info.nPos = 5;
info.nTrackPos = 2;
m_ScrollBar.SetScrollInfo(&info);
But im not sure what this nPage variable means or does, how does this
variable work ?
I have set it to nPage = 1 and the range to 0-1. It looks better but
im not sure what i am doing...
The parameters that control the scroll bar are in units of pixels, not
"lines." Set the range to the number of pixels of the total image size
(height or width). The "total image size" means the visible part plus the
invisible part that is scrolled offscreen. Set the page size to the number
of pixels that are visible.