External scrollbars
External scrollbars
I'm trying to implement a Word-like page layout for RVE and I need a way to implement my own scrollbars, because they need to be detached from the actual editor.
I'm having problems synchronizing my custom scrollbars with the actual editor scrolling, because I can't access all the necessary values of the TRVScroller.
Sergey, could you give me some pointers on what would be the best way to do this? If source modifications are required that's ok - I'm perfectly willing to do it manually on my local copy.
I'm having problems synchronizing my custom scrollbars with the actual editor scrolling, because I can't access all the necessary values of the TRVScroller.
Sergey, could you give me some pointers on what would be the best way to do this? If source modifications are required that's ok - I'm perfectly willing to do it manually on my local copy.
-
- Site Admin
- Posts: 17566
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
I thought, events and properties are enough, see this demo:
http://www.trichview.com/support/files/extscroll.zip
But may be your idea allows to implement external scrollbars more smoothly ?
http://www.trichview.com/support/files/extscroll.zip
But may be your idea allows to implement external scrollbars more smoothly ?
I've tried the source for adding external scrollbars. Replacing the source below works better. The first and last Steps when scrolling are better performed.
The source for C++:
Why is the horizontal scrollbar always visible in the TRichViewEdit? Are external scrollbars a solution to remove the 'always visible horizontal scrollbar'?
Good luck,
Pieter E.
Code: Select all
Replace 'HorizScrollBar.Position' for 'ScrollPos':
procedure TScrollForm.HorizScrollBarScroll(Sender: TObject;
ScrollCode: TScrollCode; var ScrollPos: Integer);
begin
ScrollRichView.HScrollPos := ScrollPos;
end;
Replace 'VertScrollBar.Position' for 'ScrollPos':
procedure TScrollForm.VertScrollBarScroll(Sender: TObject;
ScrollCode: TScrollCode; var ScrollPos: Integer);
begin
ScrollRichView.VScrollPos := ScrollPos;
end;
Code: Select all
SET TabStop of the Scrollbars to false.
void __fastcall TForm1::ScrollAdjust()
{
int PageSize;
vertScrollBar->PageSize = 0;
if(rve->VScrollMax >0)
{
PageSize = rve->ClientHeight / rve->VSmallStep;
vertScrollBar->Max = rve->VScrollMax + PageSize - 1;
vertScrollBar->PageSize = PageSize;
}
else vertScrollBar->Max = 0;
vertScrollBar->Position = rve->VScrollPos;
vertScrollBar->Visible = vertScrollBar->Max > 0;
horzScrollBar->PageSize = 0;
if(rve->HScrollMax > 0)
{
PageSize = rve->ClientWidth;
horzScrollBar->Max = rve->HScrollMax + PageSize - 1;
horzScrollBar->PageSize = PageSize;
}
else horzScrollBar->Max = 0;
horzScrollBar->Position = rve->HScrollPos;
horzScrollBar->Visible = horzScrollBar->Max > 0;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::rveResize(TObject *Sender)
{
ScrollAdjust();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::horzScrollBarScroll(TObject *Sender,
TScrollCode ScrollCode, int &ScrollPos)
{
rve->HScrollPos = ScrollPos;//horzScrollBar->Position;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::vertScrollBarScroll(TObject *Sender,
TScrollCode ScrollCode, int &ScrollPos)
{
rve->VScrollPos = ScrollPos;//vertScrollBar->Position;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::rveVScrolled(TObject *Sender)
{
vertScrollBar->Position = rve->VScrollPos;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::rveHScrolled(TObject *Sender)
{
horzScrollBar->Position = rve->HScrollPos;
}
//---------------------------------------------------------------------------
Good luck,
Pieter E.
-
- Site Admin
- Posts: 17566
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Dear Sergey,
I made a mistake in the above post:
Why is the vertical scrollbar always visible in the TRichViewEdit? Are external scrollbars a solution to remove the 'always visible vertical scrollbar'?
Thanks,
Pieter E.
I made a mistake in the above post:
I meant the vertical scrollbar:Why is the horizontal scrollbar always visible in the TRichViewEdit? Are external scrollbars a solution to remove the 'always visible horizontal scrollbar'?
Why is the vertical scrollbar always visible in the TRichViewEdit? Are external scrollbars a solution to remove the 'always visible vertical scrollbar'?
Thanks,
Pieter E.
-
- Site Admin
- Posts: 17566
- Joined: Sat Aug 27, 2005 10:28 am
- Contact: