Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8632991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:25:40+00:00 2026-06-12T09:25:40+00:00

Consider the following very simple unit: Unit1.pas unit Unit1; interface uses Windows, Classes, Controls,

  • 0

Consider the following very simple unit:

Unit1.pas

unit Unit1;

interface

uses
  Windows, Classes, Controls, Forms, ComCtrls;

type
  TForm1 = class(TForm)
    TreeView1: TTreeView;
    procedure FormCreate(Sender: TObject);
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

const
  SLongString = 'blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah';

procedure TForm1.FormCreate(Sender: TObject);
var
  Node: TTreeNode;
begin
  TreeView1.Width := 200;
  Node := TreeView1.Items.Add(nil, SLongString);
  Node.Text := 'blah';
end;

end.

Unit1.dfm

object Form1: TForm1
  ClientHeight = 137
  ClientWidth = 216
  OnCreate = FormCreate
  PixelsPerInch = 96
  TextHeight = 13
  object TreeView1: TTreeView
    Left = 8
    Top = 8
    Width = 198
    Height = 121
  end
end

Add this to a VCL Forms app and run. The result looks like this:

enter image description here

I would like for the horizontal scroll bar not to be showing. How can I achieve this?

Now I realise that I could remove the line of code that assigns the very long string. But this is a cut-down program for the purpose of my question. In the real app the text of the nodes is changing and I want the scroll bars to show if they are needed, and not show if they are not needed.

I know about the TVS_NOHSCROLL style but I can’t use that. Sometimes the tree view contains text that is wider than the available space. And sometimes not.

I also want to use TTreeView and do not want to use virtual tree view. Not that I have anything against virtual tree view, just that my app is currently using TTreeView.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T09:25:41+00:00Added an answer on June 12, 2026 at 9:25 am

    Very simple, use TreeView1.Items.BeginUpdate/EndUpdate methods and the scrollbar will be calculated accordingly.

    like this:

    ...
     TreeView1.Items.BeginUpdate;
     // change your nodes here
     TreeView1.Items.EndUpdate
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question is about a very strange behavior of web controls. Consider the following
Consider the following two statements out of a very simple assembly language program: DATA1
I know, this is very simple for you guys. Please consider the following code:
This is a very basic question, so please bear with me. Consider the following
Consider the following very basic WCF service implementation: public enum TransactionStatus { Success =
Consider the following regular expressions: 7+ (7)+ Does anyone that is very familiar with
I just want to know one simple thing in Java. Let's consider the following
I have a problem building a fairly simple local CGO project. Consider this very
Consider the following simple HTML: <div id=navcontainer> <a href=#><img alt= src=Img1.jpg /></a> <a href=#><img
Sweet but simple, how do Persistent joins work? Consider the following model: Person number

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.