Article View: borland.public.cppbuilder.nativeapi
Article #9020Re: Dynamic TreeViews
From: Boba
Date: Tue, 17 Aug 2004 20:55
Date: Tue, 17 Aug 2004 20:55
27 lines
1773 bytes
1773 bytes
"baysystex" <baysystex@earthlink.net> wrote in message
news:4120c046$1@newsgroups.borland.com...
> ... I really want to minimize the use of scrollbars.
> ... how can I tell programmatically whether the Height
> and Width property of the treeview are too small such
> that the component adds scrollbars?
if(TreeView1&&TreeView1->Items->Count){
/*assuming all the TreeView1->Items have same height*/
TRect r=TreeView1->Items->Item[0]->DisplayRect(false);
if(TreeView1->ClientHeight<TreeView1->Items->Count*(r.Bottom-r.Top)){
/*+you may want to add hor.scrollbar height*/
}
/*otherwise*/
TRect r; int h=0;
for(int i=0;i<TreeView1->Items->Count;i++){
r=TreeView1->Items->Item[i]->DisplayRect(false);
h+=r.Bottom-r.Top;
}
if(TreeView1->ClientHeight<h){
}
}
/*adjust TreeView1->ClientWidth as needed*/
I would post this question in the vcl.components.using group.
Boba.
Technical Details
Message-ID:
<41226fba@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<4120c046$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,ecf0dc14ef30becb X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Boba" <Boba@somewhere.world> Newsgroups: borland.public.cppbuilder.nativeapi References: <4120c046$1@newsgroups.borland.com> Subject: Re: Dynamic TreeViews Date: Tue, 17 Aug 2004 15:55:10 -0500 Lines: 30 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2919.6700 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 NNTP-Posting-Host: 208.210.156.102 Message-ID: <41226fba@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1092775866 208.210.156.102 (17 Aug 2004 13:51:06 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail