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 » Retreiving data from sorted GridCtrl
Re: Retreiving data from sorted GridCtrl [message #37284 is a reply to message #37279] Fri, 14 September 2012 11:08 Go to previous messageGo to previous message
Sender Ghost is currently offline  Sender Ghost
Messages: 301
Registered: November 2008
Senior Member
unodgs wrote on Fri, 14 September 2012 09:17

I searched through the grid api once again and Get(int r, int c) should return value from row that reflects display order.
If it's not working for you please paste your code here so I was sure we're thinking about the same problem.

If you asked to my reply, then in my example I already showed the case with Get method for selected row:
void App::OnCursor()
{
	const int cursor = list.GetCursor(), id = list.GetRowId();	
#if 0
	EditString *ctrl = reinterpret_cast<EditString *>(list.GetCtrl(id, 0));
	if (ctrl)
		text.SetText(Format("cursor = %d; id = %d; Value = \"%s\"", cursor, id, ctrl->GetData()));
#else // But also enough to use GridCtrl::Get method in this case
	text.SetText(Format("cursor = %d; id = %d; Value = \"%s\"", cursor, id, list.Get(cursor, 0)));
#endif
}

But the row id needed in the case of GetCtrl method:
void App::OnCursor()
{
	const int cursor = list.GetCursor(), id = list.GetRowId();	
#if 1
	EditString *ctrl = reinterpret_cast<EditString *>(list.GetCtrl(id, 0));
	if (ctrl)
		text.SetText(Format("cursor = %d; id = %d; Value = \"%s\"", cursor, id, ctrl->GetData()));
#else // But also enough to use GridCtrl::Get method in this case
	text.SetText(Format("cursor = %d; id = %d; Value = \"%s\"", cursor, id, list.Get(cursor, 0)));
#endif
}

Considering the same variable names inside of Value GridCtrl::Get(int r, int c) const and Ctrl * GridCtrl::GetCtrl(int r, int c) methods (as row and column), the GetCtrl method should work as Get method with current selected cursor (even in case of sorting), but it doesn't (and require row id instead), currently.

The GridCtrl::Item& GridCtrl::GetCell(int n, int m) have no methods to return Ctrl * and useful to manage Display(s), for example (in case of unimplemented void GridCtrl::SetDisplay(int r, int c, GridDisplay& gd) method).

[Updated on: Fri, 14 September 2012 11:13]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: DropGrid .t file
Next Topic: SetDisplay, which works for column why not for cells ??
Goto Forum:
  


Current Time: Fri May 10 15:02:54 CEST 2024

Total time taken to generate the page: 0.01925 seconds