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 |
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
|
|
|
|
|
Retreiving data from sorted GridCtrl
|
|
|
Re: Retreiving data from sorted GridCtrl
By: unodgs on Thu, 23 August 2012 10:09
|
|
|
Re: Retreiving data from sorted GridCtrl
|
|
|
Re: Retreiving data from sorted GridCtrl
By: unodgs on Wed, 29 August 2012 07:58
|
|
|
Re: Retreiving data from sorted GridCtrl
By: unodgs on Fri, 14 September 2012 09:17
|
|
|
Re: Retreiving data from sorted GridCtrl
By: koldo on Fri, 14 September 2012 10:45
|
|
|
Re: Retreiving data from sorted GridCtrl
By: unodgs on Fri, 14 September 2012 11:01
|
|
|
Re: Retreiving data from sorted GridCtrl
|
|
|
Re: Retreiving data from sorted GridCtrl
By: unodgs on Fri, 14 September 2012 11:41
|
|
|
Re: Retreiving data from sorted GridCtrl
By: nixnixnix on Mon, 17 September 2012 18:51
|
|
|
Re: Retreiving data from sorted GridCtrl
By: koldo on Wed, 19 September 2012 09:45
|
|
|
Re: Retreiving data from sorted GridCtrl
By: unodgs on Wed, 24 October 2012 21:54
|
|
|
Re: Retreiving data from sorted GridCtrl
By: koldo on Thu, 25 October 2012 21:12
|
Goto Forum:
Current Time: Fri May 10 15:02:54 CEST 2024
Total time taken to generate the page: 0.01925 seconds
|