Infralution Support Forum Index Infralution Support
Support groups for Infralution products
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

scroll bar reset

 
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support
View previous topic :: View next topic  
Author Message
Shailendra Baghel



Joined: 25 Nov 2005
Posts: 23

PostPosted: Thu Jan 12, 2006 1:18 pm    Post subject: scroll bar reset Reply with quote

i have a upper limit of rows. this is the maximum number of rows which can be there in the grid.
In my DataSource i have the following property
public int Count
{
get
{
return UpperLimitOfRows. // assume this is x1.
}
}

Now as the user scrolls down, i give data through GetCellData() and i came to know that i have no more data to be shown. At this point the grid asked for index x2( lets say )
and
x1 >= x2

At this point the grid should stop drawing the next rows ( x1 - x2 ) and i also want to resize the scroll bar to accomote x2 rows only. How can this be done?

Some psuedo-code will be helpful.



[/b]
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Fri Jan 13, 2006 10:29 am    Post subject: Reply with quote

Because Virtual Tree uses the DataSource IList.Count property to size the vertical scrollbar you really have to return the correct value from IList.Count. If you at first you only have an estimate for the true value then you could return that and change it when you really do know the actual value. To notify VirtualTree you should implement the IBindingList interface and raise the ListChanged event when you change the Count property. It would generally be better to increase the Count (ie underestimate it initially) so that it appears to the user as if new items are added rather then starting with (apparently) a very large number of items and then having them seemly disappear when the count is reduced.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
Shailendra Baghel



Joined: 25 Nov 2005
Posts: 23

PostPosted: Fri Jan 13, 2006 12:10 pm    Post subject: Reply with quote

Thanks for the reply.

I have the virtual tree binded with a DataSource which derives from IList.
This has the Count property where i have a upperLimit of the number of rows. Lets call this x1.

Now my requirment is that i want the scroll bar to be independent of the value given in Count.
I want to set the Maximum to some other value. Lets call this x2.
x1 will always be less than x2.

Now every row drawn has a property which indicates its value (lets call this RowValue ) and every row's value will be greater than or equal to the previous row's value. Lets assume they are R1,R2,R2..... in the order the rows are drawn starting from first row.

Values R1,R2,R3... will always be less than x2.

Now i am only considering the case when user hits the "Down" arrow key.
Whenever the TopRowIndex changes, whatever the value it contains ,the scrollPosition should be set to this value.

I know that the above requirment will require a change in the VirtualTree class, any pointers as to what needs to be changed will be great.

Thanks in advance.
Back to top
View user's profile Send private message
Shailendra Baghel



Joined: 25 Nov 2005
Posts: 23

PostPosted: Fri Jan 13, 2006 4:11 pm    Post subject: Reply with quote

I would like to add the following to my previous question:

In the virtualTree class, when you set some value to TopRowIndex, the scroll bar would move accordingly.
Now my requirment is that i want to decouple the grid with vertical scroll bar.
If i set some value to TopRowIndex, then the vertical scroll bar should not position itself accordingly but the scroll bubble should remain at whatever position i have specified by calling
VertScrollBar.Value = scrollPosition;

How can the above be achieved?
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Fri Jan 13, 2006 10:16 pm    Post subject: Reply with quote

What you are asking for sounds like a fundamental change to the design concept of Virtual Tree. It may be possible (since you have the source code) but we would only be able to provide limited assistance. Calculating the total number of displayed rows in the tree for any given expansion state and setting up the vertical scrollbar appropriately is one of the more complex issues in building a good tree control - and conseqeuently making changes to this algorithm will not be simple.

I'm not quite sure what you are trying to achieve by the proposed changes. If it is simply that you don't know up front what the child collection count is why won't the solution I proposed work for you.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
Shailendra Baghel



Joined: 25 Nov 2005
Posts: 23

PostPosted: Sat Jan 14, 2006 9:34 am    Post subject: Reply with quote

Thanks for the reply.

we have a requirment that we have to decouple the vertical scroll bar with grid.

When you set the TopRowIndex to some value, what makes the bubble in the vertical scroll bar to jump to appropriate location.
Can you provide some pointer for this in code?
Back to top
View user's profile Send private message
Shailendra Baghel



Joined: 25 Nov 2005
Posts: 23

PostPosted: Sat Jan 14, 2006 12:38 pm    Post subject: Reply with quote

This is to add to my previous query.

in the UpdateVertScrollBar() routine of VirtualTree class, i am doing the following to set the vertical scroll bar values

int scrollPosition = _topRowTime;
VertScrollBar.Minimum = _startTime;
VertScrollBar.Maximum = _endTime;
VertScrollBar.Value = scrollPosition;

I am only considering the case of "SmallIncrement". In this case i set the appropriate value of _topRowTime ( This indicates the value of TopRow ) and call Update() as follows

case ScrollEventType.SmallIncrement:
//
// update the top row
//
_topRowTime = // Get the new value of TopRow.
PerformLayout();
Update(); // force paint event to be processed for smooth scrolling
break;

Now what happens is that the scroll bubble moves to the correct position but it again jumps back to top.
In the "ScrollEventType.EndScroll" i get the following.
VertScrollBar.Value == (VertScrollBar.Minimum + TopRowIndex).

Why the bubble does not remain at the position i have specified?
Any clues?
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Sun Jan 15, 2006 10:02 pm    Post subject: Reply with quote

UpdateVertScrollBar is the only method that makes changes to the Vertical Scroll Bar parameters. As noted previously, if you decide to make changes to this part of the source code you will need to solve any issues arising from this yourself.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support 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, 2005 phpBB Group