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 » ArrayCtrl in Multiselect mode
ArrayCtrl in Multiselect mode [message #59258] Wed, 07 December 2022 05:55
pvictor is currently offline  pvictor
Messages: 67
Registered: December 2015
Member
Hi!

ArrayCtrl in Multiselect mode generates 2 events WhenSel on each mouse click. This may cause problems in some cases.
Code:
#include <CtrlLib/CtrlLib.h>

using namespace Upp;

struct Test : TopWindow {
	ArrayCtrl ar;
	Test() {
		SetRect(0, 0, 640, 480);
		Add(ar.SizePos());
		ar.MultiSelect();
		ar.AddColumn("Col 1", 1);
		for (int i=0; i<20; ++i) ar.Add(i);
		ar.WhenSel = [this] {
			RDUMP(ar.GetCursor());
		};
	}
};

GUI_APP_MAIN {
	Test().Run();
}

Log:
ar.GetCursor() = 2
ar.GetCursor() = 2
ar.GetCursor() = 4
ar.GetCursor() = 4
ar.GetCursor() = 8
ar.GetCursor() = 8

Currently, I have to add this code to the event handler:
	static int i0=-1;
	int i=ar.GetCursor();
	if (i==i0 || (i0=i)<0) return;


Best regards,
Victor
Previous Topic: GridCtrl enhancement proposition
Next Topic: multi column droplist?
Goto Forum:
  


Current Time: Fri Mar 29 14:44:45 CET 2024

Total time taken to generate the page: 0.01075 seconds