Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » ArrayCtrl speedy writes cause crashing...why?
|ArrayCtrl speedy writes cause crashing...why? [message #34228]
||Thu, 03 November 2011 18:27
Registered: January 2011
I have a program that streams data down from a local socket from another program at a pretty quick rate. I am writing this information to an ArrayCtrl just as the data is recv'd.
I am doing it like this (pseudo code mixed with real code -- the array control is "quotes")
//A "packet" is formatted with commas, like so:
//So in my array control, I make a row with "EURUSD" and put the numbers 1.2345 and 5.4321 in the columns next to it respectively. If the "EURUSD" row already exists, then I simply update the numbers.
String data = getPacketData();
split1 = Split(data,',',true);
int theCount = split1.GetCount();
int offset; //holds offset in the array ctrl for this packet
if(split1 == "Q")
offset = doesPairExist(split1); //if the row for the packet exists, it will return the row to update. Otherwise, returns -1 and we create a new row.
if(offset < 0)
offset = addToList(split1,split1,split1); //doesnt exist, add the "EURUSD" row.
tabQuotesLayout.quote.Add(split1,split1,split1); // EURUSD | 1.2345 | 5.4321
//Now here, we want to update it with the given offset
tabQuotesLayout.quote.Set(offset,2,split1); //usually, it crashes here after working fine for about 2 minutes
SO this works fine for quite some time (the quotes come in VERY fast sometimes and it's ok)
However, sometimes I get varying error messages when I attempt to "set" my coordinates on the array table above. They all seem to be related to printing into the array control. You can see all of my errors (screenshots) here:
Also, I've noticed as I'm writing to the array control so quickly and such, it seems to be "flickering" quite a bit. Is this normal? Is there a better way to set the data? It seems that it is refreshing the entire table each time for some reason.
Thanks for the help guys -- I feel like it's something easy but I've been banging my head against the wall for a couple of days now about it.
Current Time: Wed Oct 16 16:06:19 CEST 2019
Total time taken to generate the page: 0.00763 seconds