Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Horizontal autoscroll on focus does not properly scroll node into view if column width is larger than client width #397

Closed
vincentparrett opened this issue Jan 21, 2015 · 4 comments

Comments

@vincentparrett
Copy link
Contributor

From [email protected] on December 04, 2013 20:15:41

What steps will reproduce the problem? 1. Create a virtualstringtree with header and 2 columns
2. TreeOption: toDisableAutoscrollOnFocus is FALSE, toFullRowSelect is FALSE
3. Make the width of the first column wider than the clientwidth of the treeview
4. Fill the treeview with nodes. What is the expected output? What do you see instead? I expect the focused node to become fully visible (automatic horizontal scroll to include the right margin of the node caption)
Instead the automatic horizontal scroll scrolls the right margin of the column into view. When the next node is focused, the window is scrolled to the left again. And so on. What version of the product are you using? On what operating system? 5.2.2 Please provide any additional information below. I currently work around this by patching the ScrollIntoView(node, center, horizontally) method along the following lines:

if Horizontally then
// 2) scroll horizontally
ScrolledHorizontally := ScrollIntoView(FFocusedColumn, Center);

// My patch: use the node rect for scrolling
if (R.Right > ClientWidth) then begin
VScrollBarVisible := (ScrollBarOptions.Scrollbars in [{$if CompilerVersion >=24}System.UITypes.TScrollStyle.{$ifend}ssBoth, {$if CompilerVersion >=24}System.UITypes.TScrollStyle.{$ifend}ssVertical]) and
(ScrollBarOptions.AlwaysVisible or (Integer(FRangeY) > ClientHeight));
SetOffsetX(FOffsetX - R.right + ClientWidth);
ScrolledHorizontally := TRUE;
end;
end;

Original issue: http://code.google.com/p/virtual-treeview/issues/detail?id=397

@vincentparrett
Copy link
Contributor Author

From [email protected] on March 05, 2014 05:04:17

I'm not sure this is related but here's another horizontal scroll bug: in a combination of VST control anchors and option ScrollOnFocus we could get incorrect horizontal scroll on window maximize (see screenshots)

In brief:

  • VST properties are
    object vstStations: TVirtualStringTree
    Left = 6
    Top = 15
    Width = 147
    Height = 448
    Anchors = [akLeft, akTop, akBottom]
    Header.AutoSizeIndex = 0
    Header.Font.Charset = DEFAULT_CHARSET
    Header.Font.Color = clWindowText
    Header.Font.Height = -13
    Header.Font.Name = 'Tahoma'
    Header.Font.Style = []
    Header.Options = [hoVisible]
    IncrementalSearch = isVisibleOnly
    Indent = 10
    ParentShowHint = False
    ScrollBarOptions.ScrollBars = ssVertical
    ShowHint = True
    TabOrder = 0
    Columns = <
    item
    Options = [coAllowClick, coEnabled, coParentBidiMode, coParentColor, coResizable, coShowDropMark, coVisible, coSmartResize, coAllowFocus]
    Position = 0
    Width = 143
    end>
    end
  • Focus a node, maximize the window
    => you'll see unneeded scroll (screen#2).
    OR, sometimes things would seem OK, but now return the window to normal state and try selecting other node - you'll see missing repaint. Sample project attached. Bug was tested on Win7 x64 with latest trunk revision.

Attachment: VSTtest.zip screenshot 2014-03-05 002.png screenshot 2014-03-05 003.png clipboard.png

@vincentparrett
Copy link
Contributor Author

From [email protected] on March 05, 2014 05:08:06

Additions:
#1 - screen of initial state
#2 - screen of wrong scroll
#3 - screen of missing repaint / wrong scroll

  • bug doesn't occur (or maybe not noticeable) when autoscroll-on-focus option is disabled or Header is autosized.

@joachimmarder joachimmarder added this to the V7.0 milestone May 26, 2017
@joachimmarder
Copy link
Contributor

@Fr0sT-Brutal: Is this problem still present? Unfortunately the links are not working any longer.

@joachimmarder
Copy link
Contributor

I checked the repro simply using the grid demo in the Advanced sample project. I could not find any bad behavior unless the client width is smaller than the column width, as described in repro step 3. This is why I am going to change the issue title to make this clear.

The patch seems incomplete because VScrollBarVisible is assigned but never used.

@joachimmarder joachimmarder changed the title horizontal autoscroll on focus should scroll the node into view Horizontal autoscroll on focus does not properly scroll node into view if column width is larger than client wisdth Sep 10, 2017
@joachimmarder joachimmarder changed the title Horizontal autoscroll on focus does not properly scroll node into view if column width is larger than client wisdth Horizontal autoscroll on focus does not properly scroll node into view if column width is larger than client width Sep 10, 2017
joachimmarder pushed a commit that referenced this issue Sep 10, 2017
…scroll node into view if column width is larger than client width

* Removed flag toDisableAutoscrollOnFocus from default configuration of a new Virtual TreeView to achieve a more common behavior with default properties.
ValtsS pushed a commit to ValtsS/Virtual-TreeView that referenced this issue Jan 25, 2019
…ot properly scroll node into view if column width is larger than client width

* Removed flag toDisableAutoscrollOnFocus from default configuration of a new Virtual TreeView to achieve a more common behavior with default properties.

# Conflicts:
#	CHANGES.txt
#	Source/VirtualTrees.pas
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants