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 » U++ SQL » SqlArray and data validation
Re: SqlArray and data validation [message #33362 is a reply to message #33360] Thu, 28 July 2011 00:16 Go to previous messageGo to previous message
Sender Ghost is currently offline  Sender Ghost
Messages: 301
Registered: November 2008
Senior Member
In your case (with spaces and empty values) you might use following example:
#include <CtrlLib/CtrlLib.h>

using namespace Upp;

class App : public TopWindow {
public:
	typedef App CLASSNAME;
	App();
	// Ctrls
	EditString text; // or EditStringNotNull
	ArrayCtrl list;
	// Events
	bool OnAcceptRow();
};

App::App()
{
	Title("Data validation example");
	CenterScreen().Sizeable().MinimizeBox().MaximizeBox();
	SetRect(Size(320, 240));

	Add(list.SizePos());

	text.NotNull().TrimBoth(true);

	list.Appending();
	list.AddColumn("Text").Edit(text);
	list.WhenAcceptRow = THISBACK(OnAcceptRow);
}

bool App::OnAcceptRow()
{
	const String& data = text.GetData();

	if (data.IsEmpty())
		return false;

	return true;
}

GUI_APP_MAIN
{
	Ctrl::GlobalBackPaint();

	App app;
	app.Run();
}
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: master/detail sqlite3 example
Next Topic: Timestamp accuracy in postgres and upp
Goto Forum:
  


Current Time: Tue May 13 14:16:39 CEST 2025

Total time taken to generate the page: 0.04715 seconds