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 width simple question
GridCtrl column width simple question [message #21056] Wed, 29 April 2009 10:30 Go to next message
koldo is currently offline  koldo
Messages: 3358
Registered: August 2008
Senior Veteran
Hello all

I have done a simple function to write data to a GridCtrl:

void Grid_Write(int row, int col, char *str)


When the row or the column does not exist, it does:
	if (row > grid.GetRowCount()-1) {
		for (int i = grid.GetRowCount(); i < row+1; ++i)
			grid.AddRow("", 100);	
	}


Doing that with more than one column I get this: the first columns get so thin that are almost hidden.

index.php?t=getfile&id=1702&private=0

Do you know how to get all columns with same width if they - as in this case - are not added to the grid at the same time and data is included in between?

Best regards
Koldo
  • Attachment: Grid.JPG
    (Size: 26.59KB, Downloaded 436 times)


Best regards
Iñaki
Re: GridCtrl column width simple question [message #21059 is a reply to message #21056] Wed, 29 April 2009 11:47 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1366
Registered: November 2005
Location: Poland
Ultimate Contributor

Please turn off column repainting when adding columns:
void Grid_Write(int row, int col, char *str)
{
        grid.Ready(false);
	if (row > grid.GetRowCount()-1) {
		for (int i = grid.GetRowCount(); i < row+1; ++i)
			grid.AddRow("", 100);	
	}
        grid.Ready(true);
}

This must be done only in Proportional mode and only if you're adding columns when grid is visible.

[Updated on: Wed, 29 April 2009 11:48]

Report message to a moderator

Re: GridCtrl column width simple question [message #21060 is a reply to message #21059] Wed, 29 April 2009 13:06 Go to previous message
koldo is currently offline  koldo
Messages: 3358
Registered: August 2008
Senior Veteran
Hello unodgs

Almost ok. Now I initialize the grid with:

grid.ResizeColMode(0);


that is Absolute mode, and it works:

	grid.Ready(false);
	if (col > grid.GetColumnCount()-1) {
		for (int i = grid.GetColumnCount(); i < col+1; ++i) 
			grid.AddColumn("", 100);
	}		
	tabGrid->grid.Ready(true);


Best regards
Koldo


Best regards
Iñaki
Previous Topic: When ArrayCtrl is Embedded into TabCtrl, AutoHideSb() will be fail
Next Topic: How to remove a column from ArrayCtrl?
Goto Forum:
  


Current Time: Mon Apr 29 08:52:16 CEST 2024

Total time taken to generate the page: 0.03148 seconds