Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Any problems with this strategy? (Read 1438 times)
consolejoker
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 74
Joined: Dec 17th, 2007
Any problems with this strategy?
Mar 28th, 2008 at 2:33pm
Print Post  
So I have the table node and it has multiple rows each corresponding to a property. I am using the feature that was just added to creat/destroy edit control whenever a user clicks on a cell in the right hand column.

The thing is the example originally given for this has one text box for all table nodes. It does this I presume to remain lightweight. The problem is it becomes insanely convoluted to handle the events because you have a gigantic event handler that has to check state of other things.

I am simply thinking that each table node will have a different combobox/textbox for each property, with its own event handler. So I may have 50 instances of the same table node, each with 8 properties. I will therefore have 400 control instances (text boxes, combos, whatever). But I am thinking this will still be relatively lightweight in terms of painting because only 1 of the 400 will ever be visible at once, the rest will be hidden until their corresponding cell is clicked on.

So this is sort of a compromise. Do people agree that this is a decent compromise in terms of trading off a bit more sanity in event handling in exchange for some additional overhead?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Any problems with this strategy?
Reply #1 - Mar 28th, 2008 at 4:08pm
Print Post  
This test crashed at some time after the 5000th iteration:

for (int i = 0; i < 10000; ++i)
{
     TextBox tb = new TextBox();
     Controls.Add(tb);
     tb.Bounds = new Rectangle((i % 40) * 40, (i / 40) * 25, 40, 25);
}

so it isn't a good idea to create that many controls, unless you are sure there won't be more than say a couple of thousands.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
consolejoker
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 74
Joined: Dec 17th, 2007
Re: Any problems with this strategy?
Reply #2 - Mar 28th, 2008 at 7:45pm
Print Post  
5000 would be far more than I would have in my application instance. If it ever came to that I could revert to single controls. Thanks for the feedback!
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint