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 » Problem with IsRowEditable
Problem with IsRowEditable [message #36181] Wed, 09 May 2012 12:18 Go to next message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
Hello Daniel

Actual implementation is:
bool GridCtrl::IsRowEditable(int r)
{
	if(r < 0)
		r = curpos.y;
	else
		r += fixed_rows;
	
	return vitems[r].editable && hitems[curpos.x].editable;
}

I have found possible to call IsRowEditable() with r = -1 and curpos.y = -1, so an exception is thrown because of vitems[-1].

May you check this case in the function?



Best regards
Iñaki
Re: Problem with IsRowEditable [message #36183 is a reply to message #36181] Wed, 09 May 2012 12:37 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1366
Registered: November 2005
Location: Poland
Ultimate Contributor

koldo wrote on Wed, 09 May 2012 06:18

Hello Daniel
I have found possible to call IsRowEditable() with r = -1 and curpos.y = -1, so an exception is thrown because of vitems[-1].


Please describe step by step how to achieve such a grid state, only then I will be able to fix it.
Re: Problem with IsRowEditable [message #36187 is a reply to message #36183] Wed, 09 May 2012 15:34 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
unodgs wrote on Wed, 09 May 2012 12:37

koldo wrote on Wed, 09 May 2012 06:18

Hello Daniel
I have found possible to call IsRowEditable() with r = -1 and curpos.y = -1, so an exception is thrown because of vitems[-1].


Please describe step by step how to achieve such a grid state, only then I will be able to fix it.

Hello Daniel

That is going to be very difficult as it happened when moving a row. Anyway I will try to get that again.


Best regards
Iñaki
Re: Problem with IsRowEditable [message #36337 is a reply to message #36187] Mon, 21 May 2012 09:58 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
Hello Daniel

Problem found (not the solution Smile ). I enclose you a super simple test case.

GridCtrlDragtest::GridCtrlDragtest()
{
	CtrlLayout(*this, "Window title");
	
	grid.ResizeColMode(0);
	grid.Inserting().Appending().Removing().Editing().Duplicating().Clipboard().SetToolBar()
					.EvenColor().MovingRows(1).Dragging().DrawFocus().ColoringMode(2)
					.SetCursor(0);
	
	grid.AddColumn("First");
	grid.AddColumn("Second");
	
	grid.Clear();		// Problem appears if this line is set
	grid.Add("Hello", "World");
	grid.Add("Hello2", "World2");
}

GUI_APP_MAIN
{
	GridCtrlDragtest().Run();
}

When dragging second line before first line it says "Moving row 2 before row 0". It should have to say "row 1". After that the exception appears. If I remove the Clear(), everything works perfect.

index.php?t=getfile&id=3752&private=0


Best regards
Iñaki
Re: Problem with IsRowEditable [message #36345 is a reply to message #36337] Mon, 21 May 2012 16:16 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1366
Registered: November 2005
Location: Poland
Ultimate Contributor

Thank you for a great testcase! Bug hopefully fixed Smile The only thing I worry about is if that fix didn't break some other corner cases... but we will see Smile
Re: Problem with IsRowEditable [message #36350 is a reply to message #36345] Mon, 21 May 2012 18:18 Go to previous message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
Thank you Daniel. I did what I could Razz

Best regards
Iñaki
Previous Topic: ColorScheme for individual cells
Next Topic: Jsonize for GridCtrl
Goto Forum:
  


Current Time: Thu Mar 28 21:42:29 CET 2024

Total time taken to generate the page: 0.01192 seconds