Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2017-03

TSplitter refuses to move to the left with mouse (but moves via code)

2 messages · 1 person · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Jürgen Hestermann

I have a TSplitter that separates elements on the left from those on the right. I use code to move this splitter to the left or right in an KeyDown routine. Example:

-----------------------------------------------------------------------------------
case Key of VK_LEFT :
    begin
    if Shift=[ssShift] then
       begin
       if SplitterLinks.Left>50 then
          begin
          SplitterLinks.Left := SplitterLinks.Left-5;
          end;
    Key := 0;
    end;
-----------------------------------------------------------------------------------

This works fine for moving to the left and to the right.

But when I try to move the splitter with the mouse, only moving to the right works okay.
Moving to the left only moves the splitter 1 pixel (I think). Moving it again moves it another 1 pixel and so on. But I cannot move it multiple pixels in one step (as I can when moving the right).

Is this a bug?

The splitter is not anchored to the left or right (only top and bottom). Instead, elements on the left and right are anchored to the splitter.

Reply by email

Jürgen Hestermann
to Jürgen Hestermann
Jürgen Hestermann wrote 9 lines
I have a TSplitter that separates elements on the left from those on the right. .... But when I try to move the splitter with the mouse, only moving to the right works okay. Moving to the left only moves the splitter 1 pixel (I think). Moving it again moves it another 1 pixel and so on. But I cannot move it multiple pixels in one step (as I can when moving the right). Is this a bug?

It seems that this is a bug.

When I
there is a loop over all anchored controls
that calculates a value CurMaxShrink.
It seems that this routine only considers to "shrink" these anchored controls (when the splitter moves) but it is not taken into account to "move" these controls. That's a bug IMO.
If a control cannot be shrinked but can be moved
then this should work too.

I have anchored some controls to the left
which themselves have no anchor to their left side but their size is determined via AutoSize.
They are "right aligned" so to speak.
If I move the splitter to the left via code it works as expected and the anchored controls on the left are moved too. But when using the mouse then TCustomSplitter.MoveSplitter restricts the movement of the splitter to the
"shrinkability" of the anchored controls only.

Reply by email