Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to next message
r1kon is currently offline  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
Re: ArrayCtrl speedy writes cause crashing...why? [message #34229 is a reply to message #34228] Thu, 03 November 2011 22:59 Go to previous message
Sender Ghost is currently offline  Sender Ghost
Messages: 301
Registered: November 2008
Senior Member
Hello, Kevin.

Assuming, this is multithreaded application, it might have synchronization problems.
In this case you could add the GuiLock variable in the beginning of your updating function (or method):
App::OnUpdateData()
{
	GuiLock __;
	// Ctrls updating below
}

r1kon wrote on Thu, 03 November 2011 18:27


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.


There is some discussed topic about this:
"howto best Ctrl Refresh handling w/ MT & very frequent refreshes".
Previous Topic: Control Drag&drop problem
Next Topic: How to set the color of a row
Goto Forum:
  


Current Time: Fri Mar 29 01:35:05 CET 2024

Total time taken to generate the page: 0.01631 seconds