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 |
r1kon
Messages: 7 Registered: January 2011
|
Promising Member |
|
|
Hello everybody!
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:
//Q,EURUSD,1.2345,1.2345
//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.
Vector<String> split1;
if(new_packet_recvd())
{
String data = getPacketData();
split1 = Split(data,',',true);
int theCount = split1.GetCount();
int offset; //holds offset in the array ctrl for this packet
if(split1[0] == "Q")
{
offset = doesPairExist(split1[1]); //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[1],split1[2],split1[3]); //doesnt exist, add the "EURUSD" row.
tabQuotesLayout.quote.Add(split1[1],split1[2],split1[3]); // EURUSD | 1.2345 | 5.4321
}
//Now here, we want to update it with the given offset
tabQuotesLayout.quote.Set(offset,0,split1[1]);
tabQuotesLayout.quote.Set(offset,1,split1[2]);
tabQuotesLayout.quote.Set(offset,2,split1[3]); //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:
http://www.forexrenko.com/errors
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.
-Kevin
|
|
|
Goto Forum:
Current Time: Wed May 15 04:50:39 CEST 2024
Total time taken to generate the page: 0.02075 seconds
|