| View previous topic :: View next topic |
| Author |
Message |
Mauro Guest
|
Posted: Sat Dec 27, 2003 9:27 am Post subject: TScrollBox Imcrement problem |
|
|
Hi all,
I use TScrollBox component and it works great beside of one problem.
The increment of my vertical scroll bars is 20 pixels, that means that if I
click on the
arrow buttons of my scroll box component then all inside my box is scrolling
20 pixels up or down.
This is also correct. But when I move the scroll bar itself then I can
scroll my box less than 20 pixels.
This is not the wished behauvior...
Have I to set my properties in other way or have I to live with it - what
would be not the best solution...
Thanks in advance,
Mauro
|
|
| Back to top |
|
 |
JD Guest
|
Posted: Sat Dec 27, 2003 5:19 pm Post subject: Re: TScrollBox Imcrement problem |
|
|
"Mauro" <mauro23 (AT) gmx (DOT) de> wrote:
| Quote: | [...] what would be not the best solution...
|
You could subclass the control's WndProc method to intercept
the WM_VSCROLL/WM_HSCROLL message and adjust the final
positioning or you can eliminate the default scroll bar and
add a TScrollBar and use it's OnScroll event to adjust the
position once the thumb is released.
void __fastcall TForm1::ScrollBarScroll(TObject *Sender, TScrollCode ScrollCode, int &ScrollPos)
{
switch( ScrollCode )
{
case scTop : // User moved the thumb tab to the top or far left on the scroll bar.
case scLineUp : // User clicked the top or left scroll arrow or pressed the Up or Left arrow key.
case scLineDown : // User clicked the bottom or right scroll arrow or pressed the Down or Right arrow key.
case scPageUp : // User clicked the area to the left of the thumb tab or pressed the PgUp key.
case scPageDown : // User clicked the area to the right of the thumb tab or pressed the PgDn key.
case scPosition : // User positioned the thumb tab and released it.
case scTrack : // User is moving the thumb tab.
case scEndScroll : // User finished moving the thumb tab on the scroll bar.
case scBottom : // User moved the thumb tab to the bottom or far right on the scroll bar.
}
}
~ JD
|
|
| Back to top |
|
 |
Mauro Guest
|
Posted: Sun Dec 28, 2003 10:40 am Post subject: Re: TScrollBox Imcrement problem |
|
|
Thanks JD,
I think that the best idea is to subclass the the control's WndProc. Do you
mean the WndProc of the TScrollBar ??
Because then I don't need to handle the positioning manually but can change
the Position od the vertical scroll bars.
Best regards,
Marius
|
|
| Back to top |
|
 |
JD Guest
|
Posted: Sun Dec 28, 2003 8:11 pm Post subject: Re: TScrollBox Imcrement problem |
|
|
"Mauro" <mauro23 (AT) gmx (DOT) de> wrote:
| Quote: | I think that the best idea is to subclass the the control's
WndProc. Do you mean the WndProc of the TScrollBar ??
|
No. You would need to subclass the WndProc for the ScrollBox.
| Quote: | Because then I don't need to handle the positioning manually
but can change the Position od the vertical scroll bars.
|
That is exactly the same thing that you would do if you used a
TScrollBar (after you 'turned off' the ScrollBox's default
scrollbar(s)).
~ JD
|
|
| Back to top |
|
 |
|