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 » SelectRow event
SelectRow event [message #5917] Wed, 25 October 2006 11:44 Go to previous message
cioannou is currently offline  cioannou
Messages: 45
Registered: January 2006
Location: Greece
Member
Just started playing with Upp and I am trying to figure out how to handle a "selectrow" event in ArrayCtrl.

To start with, I would like to pop a message when the user clicks a row in ArrayCtrl and display the table name the user selected.

I already used the THISBACK for the button but I cannot understand how to catch and handle the WhenLeftClick event.

#include "MysqlDemo.h"
#include "mysql/mysql.h"


void MysqlDemo::click()
{
//	
//PromptOK("Button Pressed");
MySqlSession session;
String tables;

	// substitute your 'username' and 'password' here:
	if(!session.Connect("testuser", "", "test", "localhost")) {
		PromptOK("Can't connect with MySql\n");
		return;
	}
	Sql sql(session);
	sql.Execute("use test");
	sql.Execute("show tables");
	
	this->tableslist.AddColumn("MySql Tables", 100);
	
	while(sql.Fetch())
	{
		//Cout() << (String)sql[0] << '\n';
		tables += (String)sql[0] + '\n';
		
		this->mylist.Add((String)sql[0]);
		
		this->tableslist.Add((String)sql[0]);
		
	}
	//PromptOK(tables);
	
	sql.Execute("insert into testtbl (field1,field2) values ('UPP rocks','And looks easy too')");
	
	sql.Commit();
}

MysqlDemo::MysqlDemo()
{
	CtrlLayout(*this, "Mysql Upp Demo");
	this->strFullPath.SetData("Enter a string");
	this->strFileName.SetData("Another string");
	this->myButton <<= THISBACK(click);
}

GUI_APP_MAIN
{
	MysqlDemo().Run();
}

 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: WhenAddRow and WhenRemoveRow
Next Topic: horizontal scroll
Goto Forum:
  


Current Time: Tue Apr 29 01:37:41 CEST 2025

Total time taken to generate the page: 0.00688 seconds