Page 1 of 1

Handling OnMoved event for splitter to resize TSRVPageScroll

Posted: Thu Aug 25, 2011 10:42 pm
by nachbar
I noticed that the C++ Builder ActionTestTabs demo has a splitter between the TSRVPageScroll and the main TSRichViewEdit. The user should be able to use this splitter to allow more or less room for the TSRVPageScroll, but the TSRVPageScroll pages do not change size as the user moves the splitter.

You can handle the OnMoved event for the splitter with something like:

SRVPageScroll1->PageWidth = SRVPageScroll1->Width * 0.85;

That works to change the page size, but the TSRVPageScroll does not update to show the pages in the new size until the user clicks either the TSRVPageScroll or the TSRichViewEdit, which triggers some sort of update, and the pages get redrawn in the new, changed size.

I have tried multiple ways to try to get the TSRVPageScroll to automatically update after the page size is changed, including Repaint(), Invalidate(), Update() and Refresh(), on both the TSRVPageScroll and the TSRichViewEdit, but have not been able to get this to update.

Can you tell me the best way to get the TSRVPageScroll to update after changing its PageWidth?

Thank you.

Posted: Fri Aug 26, 2011 3:34 pm
by proxy3d
Fixed:

Code: Select all

procedure TSRVPageScroll.SetPageWidth(Value : Integer);
begin
  if FPageWidth <> Value then
    begin
      FPageWidth := Value;
      UpdateCache;   // <<<<<<<<<<<< ADDING
      Invalidate;
    end;
end;

That fixed it

Posted: Sun Aug 28, 2011 3:36 pm
by nachbar
Thank you!