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 

TCustomGrid (Is this the best way?)

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi VCL Components Writing
View previous topic :: View next topic  
Author Message
Mark Payton
Guest





PostPosted: Tue Oct 21, 2003 8:45 am    Post subject: TCustomGrid (Is this the best way?) Reply with quote



Dear all,

I have a component derived from TCustomGrid which at its largest could grow
to 40x40.

In each of the cells theres is a Variable which is a pointer.

So basically, for each of the cells I could assign the pointer to point at a
record structure.

Ok, in my code the user has the ability to filter 10 of the original 40.
what I do in my code to do this is I make the col/row changes to acommodate
the 10 rows in the component and then complete rebuild the cells pointers.

so for a 40x40 grid there a procedure could be called 1600 times to populate
the grid, when a user wishes to filter to 10 records (10*40) that would
bring it down to no more than 400.

Question. is this the best way to do it?

I have toyed with the idea of instead of rebuilding the grid from scratch
when someone filters the view I find the rows not required and set their
cell height to zero?

Any comments?

Many Thanks in advance

Mark


Back to top
Kurt Barthelmess
Guest





PostPosted: Tue Oct 21, 2003 12:14 pm    Post subject: Re: TCustomGrid (Is this the best way?) Reply with quote



"Mark Payton" <mark.payton (AT) nospam (DOT) derbyshire.gov.uk> wrote:

Quote:
So basically, for each of the cells I could assign the pointer to point at a
record structure.

Ok, in my code the user has the ability to filter 10 of the original 40.
what I do in my code to do this is I make the col/row changes to acommodate
the 10 rows in the component and then complete rebuild the cells pointers.

so for a 40x40 grid there a procedure could be called 1600 times to populate
the grid, when a user wishes to filter to 10 records (10*40) that would
bring it down to no more than 400.

Question. is this the best way to do it?

I have toyed with the idea of instead of rebuilding the grid from scratch
when someone filters the view I find the rows not required and set their
cell height to zero?

What's the cost to "rebuild" one cell? Does the pointer simply have to
be assigned to it, or is the data referenced by that pointer
completely reconstructed (and at what cost)? If the data is being
rebuilt, you save nothing by "hiding" the other rows - the data still
has to be rebuilt. Unless you're rebuilding unnecessarily, in which
case stop doing that<g>.

I wouldn't worry about assigning 1600 pointers. The user will never
see that. Rebuilding the data - if you have to, you have to, if you
don't have to, there's no reason to do so.

Good luck.

Kurt


Back to top
Marc Rohloff
Guest





PostPosted: Tue Oct 21, 2003 2:10 pm    Post subject: Re: TCustomGrid (Is this the best way?) Reply with quote



Quote:
Question. is this the best way to do it?
As Kurt said assigning 1600 pointers is not going to be noticable unless

there is something more complex you are doing? I personally prefer not to
have to try and keep all the data synchronised every time something
changes because I always find that I miss something. I would try and make
a function that can lookup the pointer when needed based on the current
state of the grid.

Quote:
I have toyed with the idea of instead of rebuilding the grid from scratch
when someone filters the view I find the rows not required and set their
cell height to zero?
THis is not a good idea since the user can still scroll to these records

using the arrow keys or scrollbars and would be evry confused.

Marc

Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi VCL Components Writing 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.