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 » BUG: ArrayCtrl - sorting (Does not sort when content uses Attrtext)
BUG: ArrayCtrl - sorting [message #44241] Wed, 11 February 2015 09:02 Go to previous message
slashupp is currently offline  slashupp
Messages: 231
Registered: July 2009
Experienced Member
(debian, upp v8048)

1. Cannot pass ArrayCtrl by reference (see source below)

2. col2 in ac2 does not sort when using Attrtext on content (see source below)

#include <CtrlLib/CtrlLib.h>
using namespace Upp;

struct acstest : public TopWindow
{
	typedef acstest CLASSNAME;
	Label l1,l2;
	ArrayCtrl ac1, ac2;
	acstest();
	
	//void DoSort(ArrayCtrl &ac, int col) { ac.ToggleSortColumn(col); ac.DoColumnSort(); } <<<--- MANY compile errors - why?
	void DoSort(ArrayCtrl *pac, int col) { pac->ToggleSortColumn(col); pac->DoColumnSort(); }
};

acstest::acstest()
{
	Title("ArrayCtrl-Sorting-test");
	SetRect(50,50,750,750);

	Add(l1.SetLabel(t_("no attrtext - sort OK")).LeftPosZ(5, 245).TopPosZ(5, 15));
	Add(ac1.LeftPosZ(5, 245).TopPosZ(20, 475));
	ac1.AddColumn("col1").HeaderTab().WhenAction=THISBACK2(DoSort, &ac1, 0);
	ac1.AddColumn("col2").HeaderTab().WhenAction=THISBACK2(DoSort, &ac1, 1);
	ac1.AddColumn("col3").HeaderTab().WhenAction=THISBACK2(DoSort, &ac1, 2);
	ac1.Add("bbb","ccc","aaa");
	ac1.Add("aaa","bbb","ccc");
	ac1.Add("ccc","aaa","bbb");

	Add(l2.SetLabel(t_("'col2' with attrtext - sort fails on 'col2'")).LeftPosZ(250, 245).TopPosZ(5, 15));
	Add(ac2.LeftPosZ(250, 245).TopPosZ(20, 475));
	ac2.AddColumn("col1").HeaderTab().WhenAction=THISBACK2(DoSort, &ac2, 0);
	ac2.AddColumn("col2").HeaderTab().WhenAction=THISBACK2(DoSort, &ac2, 1); //does not happen
	ac2.AddColumn("col3").HeaderTab().WhenAction=THISBACK2(DoSort, &ac2, 2);
	ac2.Add("bbb",AttrText("ccc").Align(ALIGN_CENTER).NormalInk(Red()),"aaa");
	ac2.Add("aaa",AttrText("bbb").Align(ALIGN_CENTER).NormalInk(Green()),"ccc");
	ac2.Add("ccc",AttrText("aaa").Align(ALIGN_CENTER).NormalInk(Blue()),"bbb");
}

GUI_APP_MAIN
{
	acstest().Run();	
}

[Updated on: Wed, 11 February 2015 09:03]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Previous Topic: GridCtrl: Add Option inside a column header
Next Topic: GridCtrl: How to display a menu on header right click?
Goto Forum:
  


Current Time: Thu Apr 18 10:45:14 CEST 2024

Total time taken to generate the page: 0.02355 seconds