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::Column size error
GridCtrl::Column size error [message #16829] Tue, 15 July 2008 21:18 Go to next message
michael is currently offline  michael
Messages: 153
Registered: May 2007
Location: Germany
Experienced Member
Hi there!

I'm using a GridCtrl to display some SQL-Data. When i first create my GridCtrl and add some Columns, all columns have the same width.

If i call my creation-method again, all columns are at minimum size. Only the last column is very big.

This is how i create my GridCtrl:

GridCtrl datagrid;

void myApp::CreateDatagrid(String sqlTable)
{
datagrid.Reset();

if(sqlTable == "Kunden")
{
	datagrid.AddIndex();
	datagrid.AddColumn("NAME");
	datagrid.AddColumn("NUMMER");
	datagrid.AddColumn("PRODUKT");
	datagrid.AddColumn("VERSION");
	datagrid.AddColumn("STANDORT");
	datagrid.AddColumn("ANBINDUNG");
	datagrid.AddColumn("BEMERKUNG");
}
else if(sqlTable == "Server")
{
	datagrid.AddIndex();
	datagrid.AddColumn("KUNDE");
	datagrid.AddColumn("ALIAS");
	datagrid.AddColumn("HOSTNAME");
	datagrid.AddColumn("DOMAENE");
	datagrid.AddColumn("FUNKTION");
	datagrid.AddColumn("IPADRESSE");
	datagrid.AddColumn("PROTOKOLL");
	datagrid.AddColumn("SYSTEM");
	datagrid.AddColumn("VERSION");
	datagrid.AddColumn("BEMERKUNG");
}
}


I used a SqlArray before and didn't had this error.

This must be a very simple thing but i didn't get it.
Re: GridCtrl::Column size error [message #16830 is a reply to message #16829] Tue, 15 July 2008 23:16 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1366
Registered: November 2005
Location: Poland
Ultimate Contributor

if grid is displayed (the parent window is visible) each AddColumn causes recalculating column widths. Please before adding columns add grid.Ready(false) and after grid.Ready(true). That will solve your problems.
Re: GridCtrl::Column size error [message #16831 is a reply to message #16830] Tue, 15 July 2008 23:24 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1366
Registered: November 2005
Location: Poland
Ultimate Contributor

In the next version (it's still in progress but many cool features will be there Wink ) I will change calculating columns widths in proportional mode. In most cases grid is setup once before opening dialog/window. In early stage of gridctrl AddColumn did not cause repainting header but user expects it to do it - this is the problem - it's hard to create univesal and intuitive api without corner cases.
Re: GridCtrl::Column size error [message #16832 is a reply to message #16829] Tue, 15 July 2008 23:38 Go to previous message
michael is currently offline  michael
Messages: 153
Registered: May 2007
Location: Germany
Experienced Member
Thanks Daniel,

this solved my problem. Looking forward to see the new version...
Previous Topic: ArrayCtrl: is it possible to customize the deletion message?
Next Topic: GridCtrl: Tooltip
Goto Forum:
  


Current Time: Sun Apr 28 20:37:38 CEST 2024

Total time taken to generate the page: 0.99998 seconds