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 » GridCtrl: Adding column dynamically – How to make editable
GridCtrl: Adding column dynamically – How to make editable [message #23357] Tue, 13 October 2009 18:12 Go to previous message
supa is currently offline  supa
Messages: 5
Registered: October 2009
Promising Member
First of all I am novice programmer. My understanding by going through the forum discussion is that:
(1)To make column editable I have to bind a column with an edit control. (2) These edit controls can not be declared in the constructor at the run time should be declared in the class.

My requirement is that I am adding columns dynamically at the run time, from the select statement. Therefore not sure what columns or editable fields would I need, and therefore can not declare them in the class.

void MyApp::QQuery()
{
Sql sql(SQL.GetSession());
String current_stmt_string;
QResultTab.Add(QResultTab1.SizePos(),t_("QResultTab1"));

QResultTab1.Add(QResultArray.SizePos(), t_("QResultArray"));
QResultArray.Reset();
QResultArray.ResizeColMode(0); // This will change created cloumn's width to use absolute mode from ratio mode.
//GridControl->
QResultArray.Appending().Removing().Editing().Accepting().Ca nceling().EditCell();
QResultArray.RejectNullRow();

current_stmt_string = "SELECT * FROM BOOK T1 LEFT JOIN BORROW_RECORD T2 ON T1.ID = T2.BOOK_ID";

if (sql.Execute(current_stmt_string)){
int colCount = sql.GetColumns(); // Craete columns dynamically in the grid
for (int i=0; i<colCount; ++i){
QResultArray.AddColumn(sql.GetColumnInfo(i).name, t_(sql.GetColumnInfo(i).name),50).Edit(??????????);
}
QResultArray.EditCell();
for(;;) {
Vector<Value> row;
if(!sql.Fetch(row)) break;
QResultArray.Add(row);
}
}
Sizeable().Zoomable();
}


My question is How can I make the grid cells/rows editable?
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Inheriting from DropGrid
Next Topic: DoSum(), DoAvg(), etc... and search operations
Goto Forum:
  


Current Time: Wed May 08 00:36:36 CEST 2024

Total time taken to generate the page: 0.01889 seconds