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 » Community » Newbie corner » GridCtrl column's .Edit
GridCtrl column's .Edit [message #31530] Fri, 11 March 2011 11:44 Go to next message
Wlad is currently offline  Wlad
Messages: 20
Registered: February 2010
Location: Ukraine, KharkOv
Promising Member

I want to reset the instance of GridCtrl every time (and frequently Smile )
The main purpose of sucj behavior is to tune GridCtrl to many different float 2d arrays with different sizes.

I do such sequence of actions:

...
grid.Clrear(true);
....
grid. .... .Editing()..SelectRow(false). ...
...
//bla-bla-bla
....
//-------------------
static void SetGridTHeader( GridCtrl& grid, float* t, int tCount, Ctrl& ctrl )
{
for( int i = 0; i < tCount; ++i )
{
float value = t[i];
grid.SetFixed( 0, i+1,::FormatDoubleFix(value, 0, /*FD_SIGN|*/FD_ZERO) );
grid.GetColumn( i ).Edit( ctrl );
}
}
Note! All cells are of float type.
The upmost row (header) is the set of temperature.
The "working cells" are any coefficients used in my application.
Is it right way (ctrl may be the same instance for all columns) or I MUST to pass to .Edit DIFFERENT instances of EditDouble?

[Updated on: Fri, 11 March 2011 11:48]

Report message to a moderator

Re: GridCtrl column's .Edit [message #31531 is a reply to message #31530] Fri, 11 March 2011 12:26 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1366
Registered: November 2005
Location: Poland
Ultimate Contributor

You must pass new instance for every column.
Array<EditDouble> edits;
edits.SetCount(tcount);
for( int i = 0; i < tCount; ++i ) {
grid.SetFixed(0, i + 1, FormatDoubleFix(value, 0, FD_ZERO));
grid.GetColumn(i).Edit(edits[i]);
}
Re: GridCtrl column's .Edit [message #31533 is a reply to message #31531] Fri, 11 March 2011 13:35 Go to previous messageGo to next message
Wlad is currently offline  Wlad
Messages: 20
Registered: February 2010
Location: Ukraine, KharkOv
Promising Member

unodgs wrote on Fri, 11 March 2011 13:26

You must pass new instance for every column.
Array<EditDouble> edits;
edits.SetCount(tcount);
...}


OK.
Just a little additional question.
Does SetCount call constructors (for additionally created EditDouble-s if new Count > old count) and destructors (vise verza)?
Re: GridCtrl column's .Edit [message #31534 is a reply to message #31533] Fri, 11 March 2011 13:48 Go to previous message
Wlad is currently offline  Wlad
Messages: 20
Registered: February 2010
Location: Ukraine, KharkOv
Promising Member

Wlad wrote on Fri, 11 March 2011 14:35

unodgs wrote on Fri, 11 March 2011 13:26

You must pass new instance for every column.
Array<EditDouble> edits;
edits.SetCount(tcount);
...}


OK.
Just a little additional question.
Does SetCount call constructors (for additionally created EditDouble-s if new Count > old count) and destructors (vise verza)?

Aha. I see. It's OK.
TNX very much!
Previous Topic: Some code to add an icon in statusbar
Next Topic: Error: gdkpixbuf.h
Goto Forum:
  


Current Time: Tue May 07 18:54:27 CEST 2024

Total time taken to generate the page: 0.01639 seconds