Recent

Author Topic: TPairSplitter with TMemo refresh problem  (Read 943 times)

mirco

  • Newbie
  • Posts: 3
TPairSplitter with TMemo refresh problem
« on: May 06, 2018, 11:09:00 pm »
(Lazarus v1.8.2 under Windows)

I've placed in a form a TPairSplitter (SplitterType=pstVertical). If I put a TMemo on PairSplitterSide1 or PairSplitterSide2, when I run the application the PairSplitterSide is not painted well on the screen, and it is not refreshed well when I resize the form or move the splitter position.

The only workaround I've found, is to change the parent of the TMemo, setting it as Form (instead of PairSplitterSide). In this way, I' ve to manage "manually" the resizing and the repositioning of the TMemo, by inserting appropriate code in the OnResize event of the PairSplitterSide.

I think it's not an elegant solution, but it seems to work.

Has anyone had the same problem, or has any idea how to solve it?

Thank you

jamie

  • Hero Member
  • *****
  • Posts: 1000
Re: TPairSplitter with TMemo refresh problem
« Reply #1 on: May 06, 2018, 11:27:05 pm »
use the anchor editor and have the control to the left of the splitter anchor itself to the left side of the Splitter.

 When you move the splitter, the control on the left will track with it.

 do the same for the control on the right side of the splitter, set the anchor for the left side of that control
to anchor to the right side of the splitter..

 so in the end, when you move the splitter which is not anchored to anything, which will allow itself to move
freely, the controls on the left and right side will follow.

 Right click on the controls left to right of the splitter and select ANCHOR editor..

mirco

  • Newbie
  • Posts: 3
Re: TPairSplitter with TMemo refresh problem
« Reply #2 on: May 07, 2018, 01:58:30 pm »
Hi jamie,
thank you for your answer, the method you describe is clear.

But do you think the "paint/refresh problem" I experienced with TMemo with TPairSplitter as a parent is due to a bug, or to something I do wrong?

Thank you

jamie

  • Hero Member
  • *****
  • Posts: 1000
Re: TPairSplitter with TMemo refresh problem
« Reply #3 on: May 07, 2018, 11:41:45 pm »
TSplitter should not be parenting any control in this case, especially the Tmemo

 Change the parent of the splitter to that of the background control, like the Form example.

 And if that is what you are already doing then it could be something else you are doing that is not
forcing an update..

 You can force and update...

 Form1.Invalidate or what ever form these controls are sitting on.

 Do that if you are doing something in code that may effect the display of the controls.