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 » inconsistency causes crash
inconsistency causes crash [message #27183] Tue, 29 June 2010 20:46 Go to next message
nixnixnix is currently offline  nixnixnix
Messages: 415
Registered: February 2007
Location: Kelowna, British Columbia
Senior Member
Hi Daniel,

GridCtrl::ItemRect& GridCtrl::ItemRect::Editable(bool b)
{
	editable = b;
	parent->SyncCtrls(id);
	return *this;
}

.....

void GridCtrl::SyncCtrls(int row)
{
	//if(!HasCtrls())
	//	return;
	
	Size sz = GetSize();
	genr_ctrls = false;

	
	Vector<int> cols;

	for(int i = 1; i < total_cols; i++)
		if(edits[hitems[i].id].factory && hitems[i].editable)
			cols.Add(i);

	if(cols.IsEmpty())
		return;
	

	int dy = sby + fixed_height;
	int dx = sbx + fixed_width;
	Rect r;

	int js = row < 0 ? 0 : row;
	int je = row < 0 ? total_rows : row + 1;

	for(int j = js; j < je; j++)
	{
		int idy = vitems[j].id;
		bool fixed = j < fixed_rows;
		bool create = !fixed && vitems[j].editable;

		for(int i = 0; i < cols.GetCount(); i++)
		{
			int c = cols[i];
			int idx = hitems[c].id;
			int oid = idx;

			Item *it = &items[idy][idx];

			if(it->isjoined)
			{
				it = &items[it->idy][it->idx];
				idx = it->idx;
			}


......



the id in the first function becomes the row number in the second. This causes crashes in my code which I need to workaround (SetRowCount(10) then do my shit then SetRowCount(actual number of rows I want).

Just wanted to be dutiful and report the bug.

Nick
Re: inconsistency causes crash [message #27196 is a reply to message #27183] Thu, 01 July 2010 12:49 Go to previous message
unodgs is currently offline  unodgs
Messages: 1366
Registered: November 2005
Location: Poland
Ultimate Contributor

nixnixnix wrote on Tue, 29 June 2010 14:46

Hi Daniel,

GridCtrl::ItemRect& GridCtrl::ItemRect::Editable(bool b)
{
	editable = b;
	parent->SyncCtrls(id);
	return *this;
}

.....

void GridCtrl::SyncCtrls(int row)
{
	//if(!HasCtrls())
	//	return;
	
	Size sz = GetSize();
	genr_ctrls = false;

	
	Vector<int> cols;

	for(int i = 1; i < total_cols; i++)
		if(edits[hitems[i].id].factory && hitems[i].editable)
			cols.Add(i);

	if(cols.IsEmpty())
		return;
	

	int dy = sby + fixed_height;
	int dx = sbx + fixed_width;
	Rect r;

	int js = row < 0 ? 0 : row;
	int je = row < 0 ? total_rows : row + 1;

	for(int j = js; j < je; j++)
	{
		int idy = vitems[j].id;
		bool fixed = j < fixed_rows;
		bool create = !fixed && vitems[j].editable;

		for(int i = 0; i < cols.GetCount(); i++)
		{
			int c = cols[i];
			int idx = hitems[c].id;
			int oid = idx;

			Item *it = &items[idy][idx];

			if(it->isjoined)
			{
				it = &items[it->idy][it->idx];
				idx = it->idx;
			}


......



the id in the first function becomes the row number in the second. This causes crashes in my code which I need to workaround (SetRowCount(10) then do my shit then SetRowCount(actual number of rows I want).

Just wanted to be dutiful and report the bug.

Nick


Thanks! I'll try to fix it ASAP
Previous Topic: Copy GridCtrl cell when read only
Next Topic: BUG: HeaderCtrl::Serialize
Goto Forum:
  


Current Time: Thu Mar 28 15:19:49 CET 2024

Total time taken to generate the page: 0.01411 seconds