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 edit [USEFUL EXAMPLES].
ArrayCtrl edit [USEFUL EXAMPLES]. [message #2573] Tue, 18 April 2006 01:15
fudadmin is currently offline  fudadmin
Messages: 1321
Registered: November 2005
Location: Kaunas, Lithuania
Ultimate Contributor
Administrator
I copied this from another topic because I think it's more useful
in this category.

Quote:


OK, something I should have done a long time ago, a good reference examples demonstrating different ways of editing cells in ArrayCtrl:

#include <CtrlLib/CtrlLib.h>

#define LAYOUTFILE <ArrayCtrlEdits/ArrayCtrlEdits.lay>
#include <CtrlCore/lay.h>

struct App : public WithAppLayout<TopWindow> {
	EditDouble editdbl;
	
	typedef App CLASSNAME;
	App();
};

struct SqrNumberConvert : Convert {
	virtual Value Format(const Value& q) const {
		return IsNull(q) ? (double)Null : (double)q * (double)q;
	}
};

void EditDblMinMaxFactory(One<Ctrl>& ctrl)
{
	ctrl.Create<EditDouble>().MinMax(0, 1);
}

App::App()
{
	CtrlLayout(*this);
	list.AddColumn("Number").Edit(editdbl);
	list.AddColumnAt(0, "Number^2").SetConvert(Single<SqrNumberConvert>());
	list.AddColumn("Text").Ctrls<EditString>();
	list.AddColumn("Limited number").Ctrls(EditDblMinMaxFactory);
	list.AddCtrl(editor);
	list.AddCtrl(option);
	list.Appending().Removing();
	list.SetLineCy(EditField::GetStdHeight());
	list.ColumnWidths("49 63 74 96");
}

GUI_APP_MAIN
{
	App().Run();
}

ArrayCtrlEdits.lay:

LAYOUT(AppLayout, 416, 132)
	ITEM(ArrayCtrl, list, LeftPosZ(4, 300).TopPosZ(4, 124))
	ITEM(EditInt, editor, LeftPosZ(308, 104).TopPosZ(4, 19))
	ITEM(Option, option, SetLabel(t_("Option")).LeftPosZ(308, 104).TopPosZ(28, 15))
END_LAYOUT



Mirek


P.S There is EditInt, too.

[Updated on: Mon, 01 May 2006 11:05]

Report message to a moderator

Previous Topic: ArrayCtrl: ghost Image after "delete row" [602 BUG?] -Maybe... - Update required
Next Topic: ArrayCtrl- how to get clicked row pos after click on embedded ctrl? [SOLVED]
Goto Forum:
  


Current Time: Mon Apr 29 10:55:13 CEST 2024

Total time taken to generate the page: 0.02467 seconds