BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to prevent TreeView scrolling left?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Development)
View previous topic :: View next topic  
Author Message
Roland Seidel
Guest





PostPosted: Mon Apr 09, 2007 4:44 am    Post subject: How to prevent TreeView scrolling left? Reply with quote



Hi everyone,

I've made a custom TreeView and recently put in autoscrolling so when
the user drags a node up the display scrolls down if necessary. I did
this by setting TopItem.

int x = TopItem->AbsoluteIndex;
if(x>0) TopItem = Items->Item[x-1];

That works fine except that if it encounters a node with long text the
display scrolls to the left hiding the +. How do I prevent this happening?

I'm guessing setting TopItem is calling some form of EnsureVisible that
pushes the + out of the way so you can see more text but I don't know
how to influence that either.

thanks in advance

Roland
Back to top
JD
Guest





PostPosted: Thu Apr 12, 2007 8:11 am    Post subject: Re: How to prevent TreeView scrolling left? Reply with quote



Roland Seidel <roland (AT) redcentresoftware (DOT) com> wrote:
Quote:

[...] That works fine except that if it encounters a node
with long text the display scrolls to the left hiding the +.
How do I prevent this happening?

Try:

if( TopItem->AbsoluteIndex > 0 )
{
Perform( WM_SETREDRAW, FALSE, 0 );
TopItem = Items->Item[ TopItem->AbsoluteIndex - 1 ];
Perform( WM_HSCROLL, SB_LEFT, 0 );
Perform( WM_HSCROLL, SB_ENDSCROLL, 0 );
Perform( WM_SETREDRAW, TRUE, 0 );
Invalidate();
}

~ JD
Back to top
Roland Seidel
Guest





PostPosted: Fri Apr 13, 2007 4:25 am    Post subject: Re: How to prevent TreeView scrolling left? Reply with quote



That did the trick - thanks very much.

Roland

JD wrote:
Quote:
Roland Seidel <roland (AT) redcentresoftware (DOT) com> wrote:
[...] That works fine except that if it encounters a node
with long text the display scrolls to the left hiding the +.
How do I prevent this happening?

Try:

if( TopItem->AbsoluteIndex > 0 )
{
Perform( WM_SETREDRAW, FALSE, 0 );
TopItem = Items->Item[ TopItem->AbsoluteIndex - 1 ];
Perform( WM_HSCROLL, SB_LEFT, 0 );
Perform( WM_HSCROLL, SB_ENDSCROLL, 0 );
Perform( WM_SETREDRAW, TRUE, 0 );
Invalidate();
}

~ JD
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Development) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.