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

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Free Pascal - Lazarus mailing list
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.

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] TSplitter refuses to move to the left with mouse (but moves via code)

Free Pascal - Lazarus mailing list

Hi,

 

It is caused by property TSplitter.MinSize. I just tested, when I move by mouse, I'm stopped on this value. But with code, I can go below this limit. You can modify the code:

 

if Splitter1.Left>Splitter1.MinSize then

  ...

(and set MinSize to 50 in Object Inspector).

 

so the limit will be the same for both mouse and keyboard.

 

V.

______________________________________________________________
> Od: Jürgen Hestermann via Lazarus
> Komu: Lazarus mailing list <[hidden email]>
> Datum: 20.03.2017 18:04
> Předmět: [Lazarus] TSplitter refuses to move to the left with mouse (but moves via code)
>

_____________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus-ide.org/listinfo/lazarus

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] *** GMX Spamverdacht *** Re: TSplitter refuses to move to the left with mouse (but moves via code)

Free Pascal - Lazarus mailing list
Am 2017-03-22 um 22:35 schrieb Vojtěch Čihák via Lazarus:
 > It is caused by property TSplitter.MinSize. I just tested, when I move by mouse, I'm stopped on this value. But with code, I can go below this limit. You can modify the code:
 > if Splitter1.Left>Splitter1.MinSize then
 >   ...
 > (and set MinSize to 50 in Object Inspector).
 > so the limit will be the same for both mouse and keyboard.

TSplitter.MinSize is the (min) size of the splitter itself.
It has nothing to do with the location of the splitter (just its size).
Changing this value does not solve the problem.


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] *** GMX Spamverdacht *** Re: TSplitter refuses to move to the left with mouse (but moves via code)

Free Pascal - Lazarus mailing list
On 23.03.2017 10:34, Jürgen Hestermann via Lazarus wrote:
> TSplitter.MinSize is the (min) size of the splitter itself.
> It has nothing to do with the location of the splitter (just its size).

You are wrong:
http://docs.embarcadero.com/products/rad_studio/delphiAndcpp2009/HelpUpdate2/EN/html/delphivclwin32/ExtCtrls_TSplitter_MinSize.html

The same applies for TSplitter in the LCL.

Ondrej
--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] *** GMX Spamverdacht *** Re: TSplitter refuses to move to the left with mouse (but moves via code)

Free Pascal - Lazarus mailing list
Am 2017-03-23 um 12:06 schrieb Ondrej Pokorny via Lazarus:
 > On 23.03.2017 10:34, Jürgen Hestermann via Lazarus wrote:
 >> TSplitter.MinSize is the (min) size of the splitter itself.
 >> It has nothing to do with the location of the splitter (just its size).
 > You are wrong: http://docs.embarcadero.com/products/rad_studio/delphiAndcpp2009/HelpUpdate2/EN/html/delphivclwin32/ExtCtrls_TSplitter_MinSize.html
 > The same applies for TSplitter in the LCL.

Astonishing and totaly unexpected as the help in the object inspector says:

"Minimun size for splitter - default 30 pixels"

Who decided to name this "MinSize" (Borland?).
It should have been "MinResize" or something else.

Neverthelesse, changing the value of MinSize to 3000 does not change anything with my problem.

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] TSplitter refuses to move to the left with mouse (but moves via code)

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
Am 2017-03-20 um 18:04 schrieb Jürgen Hestermann via Lazarus:
 > 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 look at TCustomSplitter.MoveSplitter
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.

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus-ide.org/listinfo/lazarus